Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

knowing functions and dataset available in a package without any manual and information (blackbox) R

I have a package which is beta version, I do not have manual neither helppage have a manual.

using following command, I can say that the package is loaded in current session.

(.packages()) 

When I search

data()

I can not see any data associated with. Is that mean that there is no dataset associate with it ? How can I know whether there are any functions?

function() # do not work. 
like image 584
jon Avatar asked Dec 12 '22 03:12

jon


2 Answers

To list all stuff,

ls("package:MASS", all = TRUE)

all = TRUE shows hidden objects (i.e., variable name beginning with ".")

To list all functions with formals,

lsf.str("package:MASS", all = TRUE)

To list all datasets with brief description

data(package = "MASS")$results

Just in case, to list all imports and exports of the namespace,

getNamespaceInfo("MASS", "imports")

like image 94
kohske Avatar answered Dec 16 '22 08:12

kohske


From the help page for ?data

try(data(package = "rpart") ) # list the data sets in the rpart package

And this is one of the reasons why the uses of the name 'data' is deprecated.

try(fortunes::fortune("dog") )
like image 30
IRTFM Avatar answered Dec 16 '22 06:12

IRTFM