This question already has answers here:
Error: could not find function ... in R
(10 answers)
Closed 1 year ago.
I am using Google Colab to work on a final project with a set of groupmates. Unfortunately, Colab is not working and I am getting this error. I was able to successfully install and then call the library for the package but when I run the DDPLY code Colab doesn't work.
If anyone can provide insight as to how to fix this it would be greatly appreciated!
It looks like you are loading dplyr and not plyr.
Calling it with either library(plyr); ddply() or plyr::ddply() should solve your issue
I think ddply is not in dplyr (daft I know!) it is in plyr
So you need
library (plyr)
(And on first use a install.packages("plyr") too)
Related
This question already has answers here:
Error: could not find function ... in R
(10 answers)
Closed 10 days ago.
I'm having real trouble running the function write.xlsx - the error "could not find function "write.xlsx"
I've already tried to:
Install the packages xlsx, readxl, writexl, XLConnect but no one of these is working.
Install Java JRE, but it's not working as well
Have you guys ever had a similar problem before?
I'm really needing to start running those flows which are properly working in other machines.
PS: I'm a beginner in the R coding
After installing the package xlsx you should also load the library in order to use the function, like this:
library(xlsx)
If you're just going to use the function one time you can call it without loading the library first like this:
xlsx::write.xlsx(data, file = "file.xlsx")
Hope this helps
I was analyzing data in a R Markdown file named as "A", and suddenly the group_by() function from dplyr package didn't work as expected anymore. Then I found out the similar problem has been addressed here: Why are my dplyr group_by & summarize not working properly? (name-collision with plyr). The solution is to detach the plyr package.
However, when I tried detach(package:plyr), I got an error message:"Error: package ‘plyr’ is required by ‘Rmisc’ so will not be detached". I was not using "Rmisc" in my current file "A", but "Rmisc" was used by another R Markdown file named as "B" which was also opened.
I finally had to use dplyr::group_by() to solve the problem. And actually I had to put dplyr:: to all the functions I tried to use such as mutate() and select(). This was really annoying!
So, my question is, in Rstudio, how to isolate the installed packages such as "Rmisc" to just a specific file such as "B" where it was needed, while the other files, such as "A" would not be affected? Thanks!
I would greatly appreciate your kind help!
Jeff
This question already has answers here:
How to find all functions in an R package?
(6 answers)
Closed 7 years ago.
I would like to know if there is a command, using which one can view all the functions that are built into an R package.
For example, let's say I loaded a package into environment:
require(dplyr)
Now, I would like to get a list of all the functions present in the dplyr package.
Is there any way to get such a list?
You can use lsf.str.
For instance:
lsf.str("package:dplyr")
To list all objects in the package use ls
ls("package:dplyr")
Note that the package must be attached.
To see the list of currently loaded packages use
search()
Alternatively calling the help would also do, even if the package is not attached:
help(package = dplyr)
Finally, you can use RStudio which provides an autocomplete function. So, for instance, typing dplyr:: in the console or while editing a file will result in a popup list of all dplyr functions/objects.
I am attempting to run the R code from this question
and I get the following error:
Error in rename(x, .base_to_ggplot, warn_missing = FALSE) :
could not find function "revalue"
I wonder whether it's an incompatibility between the R version I'm using and ggplot2 (v. 0.9.3.1). Is anybody aware of this problem, or is my issue something else?
Yes, ggplot2 works with the current version of R (3.0.1)
revalue is not a function in ggplot2, it's a function in plyr as pointed out in the comments.
A simple google search function revalue R will reveal this. Many packages depend on one another - so when you see an error like the one above, you need to use google/some other resource to find which package the missing function is from.
How does one look up the help manual page for a function and specify the package in R? For example, count appears in both seqinr and plyr. If I want to look up count in plyr, what's the command? I've tried a few obvious (but wrong) guesses such as "?plyr::count"
EDIT:
When I do ?count, I get the following message:
Help on topic 'count' was found in the following packages:
Package Library
plyr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
seqinr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
When I do ?plyr::count, I get:
No documentation for 'plyr::count' in specified packages and libraries:
you could try '??plyr::count'
When I do ?plyr:::count, I get:
No documentation for 'plyr:::count' in specified packages and libraries:
you could try '??plyr:::count'
Adding two question marks also gets me a no documentation found error as well. Looking up help for non-ambiguous funcitons is working fine (e.g. ?plot)
This is with R 2.15.0 on OSX running in emacs + ESS.
Use the package= argument to help:
help("count", package="plyr")
The correct way to do this is:
?plyr::count
?plyr:::count
See ?"?" for details - both examples are shown.
Both work for me with both packages loaded and even without the package loaded. That begs the question if you have the packages installed?
You were close, you need three : :::
?seqinr:::count # for seqinr
?plyr:::count # for plyr