-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.

1
  • 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. Commented Sep 27, 2016 at 7:21

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.