This question already has answers here:
Check if R package is installed then load library
(6 answers)
Closed 6 years ago.
When running a script with new libraries, I will automatically respond to the error message Error in library(x) : there is no package called ‘x’ with install.packages("x"). Is there a way to automate this process?
if(! require("x")) install.packages("x")
but see Check if R package is installed then load library for more robust solutions
Related
This question already has answers here:
How do you use multiple versions of the same R package?
(3 answers)
Closed 4 years ago.
I wonder, can I do any harm to my system (or the stability of R installation) if I install some package twice. Or when installing a new package it will simply overwrite the previous version.
Happens to me all the time that I execute install.packages on something that I have installed before. You just get a warning.
This question already has answers here:
How do I install an R package from the source tarball on windows?
(6 answers)
Closed 4 years ago.
I am struggling to install the 1.1-13 version of lme4 package in R. I went to https://cran.r-project.org/src/contrib/Archive/lme4/ . But I am not understanding the next step after downloading lme4_1.1-13.tar.gz. What should I do next?
Thanks in advance.
You do the follow:
install.packages("path_to_file/lme4_1.1-13.tar.gz", repos = NULL, type="source")
Or in the terminal:
R CMD INSTALL lme4_1.1-13.tar.gz
This second way will not work if the needed system tools for compilation are not present.
This question already has answers here:
readRDS(file) in R
(14 answers)
Closed 4 years ago.
I tried to install ggtern, Ternary and Rtools (the latter as a test) but it doesn't work and always give me this error message
Error in readRDS(file) : unknown input format
Error in readRDS(pfile) : unknown input format
Does anyone know how I can solve this?
Thanks
Which version of R you are using to install the package?
Possible solutions
Delete your .Rhistory and .RData files in the directory in which you are running R.
Run update.packages()
Try and detect "bad files" in your library directories. You can do this in R
Delete the directory in which you have stored your downloaded packages.
This question already has an answer here:
Installed package, but getting an error that function can't be found R [duplicate]
(1 answer)
Closed 8 years ago.
I installed swirl package in R studio console and I started learning R programming. After completing a chapter I closed R studio. I didn't save the workspace while quitting the R studio.
After a day I started R-Studio again and ran swirl() command in the console. The R-Studio gave this error - "Error: could not find function "swirl""
Do I need to install the package everytime in R studio? Doesnt it store in R ? Pls help.
you should first type the command library (swirl). That will load the library in the namespace and allow you to use its functions.
This question already has answers here:
Installing older version of R package
(8 answers)
Closed 7 years ago.
I am trying to install the R package bigrf using the following command:
install.packages('bigrf')
However, I receive this error:
Warning in install.packages: package 'bigrf' is not available (for R version 3.0.2).
I understand that the package was not built for R version 3.0.2, but is it not possible for me to install it regardless with the understanding that it might not have complete forward compatibility?
The safest thing to do would be to download the last version that the package was built for (link) and run the code on that version.
The easiest way to rebuild a package from source is using R-Studio.
They have a good walkthrough. You will need to use the devtools package as well.