简体   繁体   中英

Unable to view source code of a package in R

I am trying to view the source code of the function knnreg in caret.

> getAnywhere(knnreg.default)
A single object matching ‘knnreg.default’ was found
It was found in the following places
  package:caret
  registered S3 method for knnreg from namespace caret
  namespace:caret
with value

function (x, ...) 
{
    if (!any(class(x) %in% "formula")) 
        stop("knnreg only implemented for formula objects")
}
<environment: namespace:caret>

What's happening? Where is the source code?

I think the error message is pretty obvious:

knnreg only implemented for formula objects

Use getAnywhere(knnreg.formula) to see the source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM