Installing packages in R [duplicate] - r

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.

Related

can't install package in Rstudio [duplicate]

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.

Barnard's Exact Test in R [duplicate]

This question already has answers here:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
(18 answers)
Closed 5 years ago.
I am performing Barnard's exact test for 2X2 contingency table. I found https://cran.r-project.org/web/packages/Exact/Exact.pdf for doing Barnard's test in R. My R version is 3.2.2 . I am trying to install package Exact, but it seems the package is not available for R version 3.2.2 . Is it so? How do you implement Barnard's test in R ?
Edit:
install.packages("Exact")
It gives the following message
Warning: unable to access index for repository https://mirror.aarnet.edu.au/pub/CRAN/src/contrib
Warning: unable to access index for repository https://mirror.aarnet.edu.au/pub/CRAN/bin/windows/contrib/3.2
Warning message:
package ‘Exact’ is not available (for R version 3.2.2)
library(Exact)
Error in library(Exact) : there is no package called ‘Exact’
Did you type the following exactly? (See what I did there)
install.packages("Exact")

Can I make R install packages automatically? [duplicate]

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

Error: package ‘dmGWAS’ was built before R 3.0.0: please re-install it [duplicate]

This question already has answers here:
How do I install an R package from the source tarball on windows?
(6 answers)
Closed 1 year ago.
I downloaded the Windows binary file dmGWAS_2.3.zip clickHere and try to install it by clicking Packages/install package from local zip file. After install, when I try to load 'dmGWAS' I got the error 'Error: package ‘dmGWAS’ was built before R 3.0.0: please re-install it'. I am using win 7 and R 3.1.0.
I searched similar questions but find no solution.
try:
> update.packages(checkBuilt = TRUE, ask = FALSE)
The authors release the newest version dmGWAS_3.0, which is compatible with dmGWAS_2.3. You can use the new version at http://bioinfo.mc.vanderbilt.edu/dmGWAS/

How do I install an older R package? [duplicate]

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.

Resources