Some functions not exported?
Closed this issue · 1 comments
The below documented functions appear not to be available
library(pedtools)
as.data.frame.ped
#> Error in eval(expr, envir, enclos): object 'as.data.frame.ped' not found
as.matrix.ped
#> Error in eval(expr, envir, enclos): object 'as.matrix.ped' not found
as.ped.data.frame
#> Error in eval(expr, envir, enclos): object 'as.ped.data.frame' not found
as.matrix.ped
#> Error in eval(expr, envir, enclos): object 'as.matrix.ped' not found
Created on 2019-04-24 by the reprex package (v0.2.1)
These are methods for S3 generics, which behave somewhat differently than other functions. For example, as.data.frame()
is a generic function in base R, for which many different methods have been written:
library(pedtools)
methods(as.data.frame)
#> [1] as.data.frame.aovproj* as.data.frame.array
#> [3] as.data.frame.AsIs as.data.frame.character
#> [5] as.data.frame.complex as.data.frame.data.frame
#> [7] as.data.frame.Date as.data.frame.default
#> [9] as.data.frame.difftime as.data.frame.factor
#> [11] as.data.frame.ftable* as.data.frame.integer
#> [13] as.data.frame.list as.data.frame.logical
#> [15] as.data.frame.logLik* as.data.frame.matrix
#> [17] as.data.frame.model.matrix as.data.frame.noquote
#> [19] as.data.frame.numeric as.data.frame.numeric_version
#> [21] as.data.frame.ordered as.data.frame.ped*
#> [23] as.data.frame.POSIXct as.data.frame.POSIXlt
#> [25] as.data.frame.raw as.data.frame.table
#> [27] as.data.frame.ts as.data.frame.vector
#> see '?methods' for accessing help and source code
When called, as.data.frame()
looks at the class of the first argument, and forwards (dispatches) to the appropriate method. pedtools
provides a method for ped
objects, that's why as.data.frame.ped()
is included in the above list (if we hadn't loaded pedtools
first, it wouldn't be included).
The documentation for these functions are as usual, invoked e.g. by ?as.data.frame.ped
.
To see the code, you can use for example
getS3method("as.data.frame", class = "ped")
or
getAnywhere("as.data.frame.ped")