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
Related
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)
This question already has answers here:
Load R package from character string
(2 answers)
Closed 6 years ago.
I would like to install/load packages from a different location that is default. I dont have admin privileges so I cant access my .rprofile from the control panel.
My thought was I could just make a different library function, so I dont have to type a lib.loc statement every time i want to install/load a function. This is what i think the "liBerty" function should look like.
liBerty <- function(a) {
require(a,lib.loc="C:\\Users\\bert\\Documents\\rpackages" )
}
liBerty(tm)
The error I am getting states "there is no package 'a'.". Is there a way i can write this function to accomplish my task?
The function needs to also be modified for installing packages
install.Bertages<-function(b){
install.packages(b,lib="C:\\Users\\bert\\Documents\\rpackages")
}
liBerty<-function(a){
require(a,lib.loc="C:\\Users\\bert\\Documents\\rpackages",
character.only=TRUE )
}
install.Bertages("lubridate")
liBerty("lubridate")
This question already has answers here:
Possible to create Rd help files for objects not in a package?
(7 answers)
Closed 7 years ago.
I need to generate documentation for a collection of R programs. Unfortunately, building a package based on the source code is not an option (I know how to do that, and I have already experimented with RStudio, roxygen2, and packages, and it works like a charm). Can I use roxygen2 to to generate documentation from the R source code without building a package in a way similar to how doxygen works with C++? If not, are there other options for documenting R code that do not rely on packages?
If your only after the documentation, devtools::document() will build the documentation files without building the package.
This question already has answers here:
Error: could not find function ... in R
(10 answers)
Closed 8 years ago.
I am having trouble with Rfacebook- I install it, which seems to go fine, but then when I call fbOAuth exactly as I've seen in examples, it says function not found. I wonder if my directories/libraries/working spaces aren't lined up? It's showing a temporary location but I also see an Rfacebook folder get created in my designated library.
Thanks!
package ‘Rfacebook’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Katherine\AppData\Local\Temp\Rtmp23Rk2g\downloaded_packages
> fb_oauth <- fbOAuth(app_id="xxxxx", app_secret = "xxxxx")
Error: could not find function "fbOAuth"
This is R FAQ 7.30; I would have expected it is also duplicated on SO somewhere but can't find it at the moment.
You need
library("Rfacebook") ## quotation marks optional but recommended
You need to run this command every time you start a new R session (or add it to your .Rprofile file), but you only need to install the package once (for every machine/R installation you use).
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to properly use functions from other packages in a R package
load data set automatically
I've built an R package and am now testing it. It requires several packages like scatterplot3d, gdata, etc.
How can I get those packages to load automatically, when someone loads my package?
Thanks!
Edit Re Comments: I've already set imports in the Description and I've set the namespaces file. I know this works because the examples I put in work when I do R CMD Check. However, if I just load up R, type library(mypackage) it gives me an error.
Edit: Solved, I moved the packages I had in the imports section to the depends section. Thank you!