Cannot install packages in Rstudio - r

I just installed R studio and I was trying to install rmarkdown. However, I got the error as below. I unchecked the box ''Tools -> Global Options -> Packages -> Use secure download method for HTTP'' as someone suggested. No help. I tried other packages, I got the same error.

You should remove the package and reinstall it using dependencies = TRUE:
remove.packages("rmarkdown")
install.packages("rmarkdown", dependencies = TRUE)
library(rmarkdown)
Output:
Warning message:
package ‘rmarkdown’ was built under R version 4.1.2

I had the same issue and it was due to the newest version of the toolboxes include the names is under new package names. Go to the URL https://cran.rstudio.com/src/contrib/PACKAGES and search for "rmarkdown". Find the package name and try to install that instead. It's like a .zip file that includes several packages to your library. Try install.packages("accucor"). It worked for me at least, and then try to install the rmarkdown package.

Related

How to Install mlr3extralearners in R?

So I am going to do some survivalsvm process and I need the mlr3extralearners package from GitHub. When I tried to install it locally using the tar.gz file, it said
Execution halted
Warning in install.packages: installation of package had non-zero exit status
I also tried to use the zip file, and it said
install.packages("C:/Users/Ivan/Downloads/mlr3extralearners-0.5.49.zip", repos = NULL, type = "win.binary", lib="C:/R-4.2.1/library")
then nothing happened.
I also tried using devtools::install_github("mlr-org/mlr3extralearners"), but the output was the same when I used the tar.gz file. When I checked in my library, I already have the mlr3extralearners package, but when I call it using library(mlr3extralearners), it does not work. Does anyone know how to solve this? Any help is appreciated.
https://rdrr.io/github/mlr-org/mlr3extralearners/
I believe this should work for you:
Install the latest version of this package by entering the following in R:
install.packages("remotes")
remotes::install_github("mlr-org/mlr3extralearners")

Install R packages problem using RStudio Package Manager

I tried to install R packages using RStudio Package Manager using the following code:
install.packages("dplyr", type = "source")
and
install.packages("dplyr")
and it gives the following error:
Error in install.packages : invalid version specification 'r56550'
What should I do? I tried to google the error but nothing comes up. I have tried to delete and reinstall R and RStudio but i still received the error. I tried to download both the existing binary and the source file and neither ways worked. I tried to install different packages and repeated in both R and Rstudio and nothing worked.
Thank you!
Update 1: I'm using R version 4.0.5 and RStudio version 1.4.1106. I have also downloaded Rtools40 according to the instruction in the following website: https://cran.r-project.org/bin/windows/Rtools/. I'm using Windows. By 'R Manager' I meant the package manager console in RStudio.
Update 2: I'm not sure if there is no network issue or proxy. If I download the packages directly through the CRAN mirror, then it works. But we are trying to download packages in an offline environment, that's why I need RStudio Package Manager.

Installing custom R package in the WRDS cloud

I tried to install custom R package 'sf' in the WRDS cloud via interactive R session, but failed. The instruction from WRDS is:
https://wrds-www.wharton.upenn.edu/pages/support/programming-wrds/programming-r/installing-r-packages/
I followed the instructions and the package 'sf_0.9-6.tar.gz' is already in the '~/lib/R' directory:
When i tried to install the package in the interactive R session, i typed in the code :
install.packages("~/sf_0.9-6.tar.gz", lib = "~/lib/R")
I got the following error:
I don't understand why it is an invalid package, even though i've downloaded the package directly from CRAN. Besides, the package should work on the R 3.6.2.
Could anyone help? I would highly appreciated it!
I faced a similar issue with installation of another user-written package (from CRAN) on R 4.0.5 but, I guess, the root cause of the issue is the same which is that install.packages can not find the package TAR file in the directory /home/<institutionName>/<userName> (note: this is what the ~ stands for).
Could you try replacing your code:
install.packages("~/sf_0.9-6.tar.gz", lib = "~/lib/R")
with
install.packages("~/lib/R/sf_0.9-6.tar.gz", lib = "~/lib/R")
Expanding the path of the package to the newly created R sub-folder within the lib folder worked for me.

How to install R package with its vignettes from source via RStudio `Install and Restart` button?

I've downloaded the source code of an R package (You may use this R package by git-cloneing or downloading zipped version). I want to install the package via the Install and Restart button (4) in the Build tab (1). In configuration (2) I selected "Vignettes" (3).
Other configuration options I use:
Unfortunately, when I press Install and Restart, the package is installed but without its vignettes,i.e., no vignettes in the package's help page are displayed:
When I install the same package from CRAN, the vignettes are present:
Question: Is there a way to install a package with its vignettes by using this Install and Restart button. Maybe some configuration options are missing?
I use RStudio 1.3.1091, R 4.0.2 on Windows 10.
Update:
I'm aware of the solutions like:
devtools::install_github("r-lib/pkgdown", build_vignettes = TRUE)
Or in the Terminal window:
R CMD build .
R CMD INSTALL pkgdown_1.6.1.9000.tar.gz
But my question is about the functionality of the Install and Restart button (or similar tools in RStudio).
I installed this package in RStudio using devtools::install_github("r-lib/pkgdown", build_vignettes = TRUE). The vignettes are installing using this method.
vignette(package = "pkgdown")
Vignettes in package ‘pkgdown’:
linking Auto-linking (source, html)
pkgdown Introduction to pkgdown (source, html)
metadata Metadata (source, html)
search Search (source, html)
Furthermore, vignette("pkgdown") brings up the main vignette for the package. However, the help documentation landing page for the package appears to have been updated to no longer link to the vignettes.
Report this as a potential issue: https://github.com/r-lib/pkgdown/issues
If the vignettes are not installing when using RStudio's menu- and GUI-based approach, perhaps the issue is a bug in RStudio and not in the package.

Trying to install library 'quantmod' in R

I'm trying to download library 'quantmod' in R:
install.packages("quantmod")
console:
The downloaded source packages are in
‘/tmp/RtmpwSKGIl/downloaded_packages’
then:
library("quantmod", lib.loc="/tmp/RtmpwSKGIl/downloaded_packages")
console:
Error in library("quantmod", lib.loc = "/tmp/RtmpwSKGIl/downloaded_packages") :
there is no package called ‘quantmod’
What is the problem?
I get no problem when I try to load this package.Have you tried to provide R the full name path to your package file directory ?C:/Users/...Is your R version up to date ? Try to check if you have the latest, I tried and it worked with :
R 3.3.3
If you are a Windows or MAC user you might want to force the download of the package from source to binary, this can be done by setting the right options in the install.packages command:
options(install.packages.check.source = "no")
https://stat.ethz.ch/R-manual/R-devel/library/utils/html/install.packages.html
I guess I am a year late, but just got out of this situation by installing the Package from R (instead of RStudio) by changing the CRAN.
You can then run library(quantmod) in Rstudio. Hope this works(worked?) for you too.
I am ready to go now!

Resources