![]() You also need to know the namespace in which the function is found. ![]() To call such function if you know what you are doing requires the use of. Keep in mind that R versions older than R3.0.0 are incompatible with packages built for R3.0.0 and later versions.Īnother problem, in the presence of a NAMESPACE, is that you are trying to run an unexported function from package foo.įor example (contrived, I know, but): > mod plot.prcomp(mod)Įrror: could not find function "plot.prcomp"įirstly, you shouldn't be calling S3 methods directly, but lets assume plot.prcomp was actually some useful internal function in package foo. You also find a list of functions that need to be backported on the git repo of backports. If you use an older R version and want to use a newer function, you can use the package backports to make such functions available. Newly added functions (eg hasName in R 3.4.0) won't be found then. Sometimes you need to use an older version of R, but run code created for a newer version. RSiteSearch("some.function") or searching with rdocumentation or rseek are alternative ways to find the function.If you have no clue about the package, you can use findFn in the sos package as explained in this answer.find and getAnywhere can also be used to locate functions.If you're sure you installed and attached/loaded the right package, type arch("some.function") or ?some.function to get an information box that can tell you in which package it is contained.If you're not sure in which package that function is situated, you can do a few things. Are you using a different version of the specific package? This could be in either direction: functions are added and removed over time, and it's possible the code you're referencing is expecting a newer or older version of the package than what you have installed.Are you using an older R version where this function didn't exist yet?.Require(thePackage) (and check its return value) or library(thePackage) (this should be done every time you start a new R session) Did you attach that package to the workspace ?.Did you install the package that contains the function? install.packages("thePackage") (this only needs to be done once).Did you write the name of your function correctly? Names are case sensitive.There are a few things you should check : ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |