Installing custom R package in the WRDS cloud

183 Views Asked by At

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:

List of files in the 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: error description

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!

1

There are 1 best solutions below

1
agogar On BEST ANSWER

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.