-1

I am using randomForest package in R. I have installed and loaded. Now I want to see the randomForest() Function, it says it uses method called `randomForest. I have implemented the following code:

   installed.packages("randomForest")
   library(randomForest)
   randomForest
   # function (x, ...) 
   # UseMethod("randomForest")
   # <environment: namespace:randomForest>

   methods(randomForest)
   # [1] randomForest.default* randomForest.formula*
   # see '?methods' for accessing help and source code

   randomForest.default
   # Error: object 'randomForest.default' not found

Example for summary() function,

   summary
   # function (object, ...) 
   # UseMethod("summary")
   # <bytecode: 0x00000000173508c0>
   # <environment: namespace:base>

   methods(summary)
   #  [1] summary,ANY-method             summary,diagonalMatrix-method  summary,mle-method            
   #  [4] summary,sparseMatrix-method    summary.Anova.mlm*             summary.aov                   
   #  [7] summary.aovlist*               summary.aspell*                summary.bag*  

   summary.bag*
   + 

   summary.bag
   # Error: object 'summary.bag' not found

As you can see above, few method names have asterisk in it, and rest of them are without them. SO I am able to access codes for methods without asterisk by just typing its name on console.

How to access codes for functions which uses methods having asterisk * in its name, what does it signify.

Any help is highly appreciated. Thanks.

Sowmya S. Manian
  • 3,723
  • 3
  • 18
  • 30
  • 2
    Please read the manual pages of the functions you are using (especially when explicitely asked for: _# see '?methods' for accessing help and source code_). `?methods` clearly states: _The S3 method name is followed by an asterisk * if the method definition is not exported from the package namespace in which the method is defined._ There are _no_ asterisks in function names. – Uwe Sep 27 '16 at 07:21

1 Answers1

1

Functions that end with an asterisks are not exported in the namespace. They are either S3 methods or functions meant for internal use. You can still call them directly using getAnywhere(randomForest.default) or randomForest:::randomForest.default

Chrisss
  • 3,211
  • 1
  • 16
  • 13