repl.it
is an excellent, useful and for now free tool for executing R code online. However, I have difficulties using non-standard R packages. In fact, when I try to install something, the following happens:
install.packages("vegan")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("vegan") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Error in install.packages("vegan") : unable to install packages
In the documentation , it is only mentioned that it is possible to install other libraries or packages in the case of Python
, Javascript
or Ruby
.
Is there a way to be able to use packages outside of the base distribution in this tool?
Not in a standard way, that is, by means of a simple:
install.packages("vegan")
. The mistake is clear. We do not have write permission on the folder where the new package would go.Solving this is possible but a bit complex, let's see:
library
use this folder to find the installed packageA
requires a packageB
,A
we can install it in a suitable folder, but theB
default will be installed in the one in which we do not have permissions. The solution in this case is to install the dependencies one by one.For example, if we need the package
vegan
, we must first install its dependencies, in this case the packagepermute
. We can use the user's folderhome
, where we have the proper permissions to do this:Then, yes, we can load them, but we must indicate the location of these libraries:
secondary observation
I add, that another alternative could be:
https://rstudio.cloud
, for now it is free access, through a secure login with an account ofgoogle
orgithub
. What it offers you is arstudio
fully functional and online. Installing and using new packages is exactly the same as you would from arstudio
local.