Trying to install library 'quantmod' in R - 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!

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")

Cannot install packages in Rstudio

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.

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.

Can not Download 'digest' package in R

I am trying to create clustered box plots in R. Everything about my code seems on track, but when I try to run it I get the error warning
"Error in loadNamespace(name) : there is no package called ‘digest’.
When I try to download the package digest in the R package Installer I get a bunch of errors stating that the download of digest failed.
How do I get the digest package, OR is there a way to do clustered box plots without this? Thanks!
I had the same problem with install.packages("digest") on OS10.11.6 (running with the defaults). But it worked by specifying the repos:
install.packages('digest', repos='http://cran.us.r-project.org')
I had a similar error message recently and managed to solve the problem by downloading the tar.gz file directly from the CRAN Repository (see https://cran.r-project.org/web/packages/digest/index.html and download "digest_0.6.15.tar.gz") and then you can install it in RStudio (Tools -> Install Packages -> Install from Package/Archive File).

Resources