jcrodriguez1989 / rco

Package: The R Code Optimizer
https://jcrodriguez1989.github.io/rco/
84 stars 19 forks source link

Cannot install in a vanilla R #13

Closed nwolovick closed 5 years ago

nwolovick commented 5 years ago

Doing as the Installation Guide says

if (!require("remotes")) {
  install.packages("remotes")
}
remotes::install_github("jcrodriguez1989/rco")

I got:

$ R

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> if (!require("remotes")) {
+   install.packages("remotes")
+ }
Loading required package: remotes
> remotes::install_github("jcrodriguez1989/rco")
Downloading GitHub repo jcrodriguez1989/rco@master
Running `R CMD build`...
* checking for file ‘/tmp/RtmpcCBXuB/remotes430c1893ba9e/jcrodriguez1989-rco-30e0775/DESCRIPTION’ ... OK
* preparing ‘rco’:
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘rco_0.1.003.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error in i.p(...) : 
  (converted from warning) 'lib = "/usr/local/lib/R/site-library"' is not writable

Previously I installed r-cran-remotes in my Debian testing box.

jcrodriguez1989 commented 5 years ago

Hi @nwolovick , thanks for your interest in rco. Apparently, you are having issues because you don't have write permission in the default location to install R libraries. If you type in an R terminal:

.libPaths()

It will return the paths in which R will try to install new libraries. If you don't want to install rco as a system-wide library (as root user), you can follow these steps:

1) Make sure you have write permissions to a folder in which you want to install libraries, e.g., ~/local/R_libs/3.5.2 2) From R, once it starts, type

.libPaths("~/local/R_libs/3.5.2")

3) Retry rco installation

If you want this path to be persistently used as default libraries path you can add .libPaths("~/local/R_libs/3.5.2") to your ~/.Rprofile file.

best, Juan Cruz

nwolovick commented 5 years ago

Ok!

mkdir -p ~/local/R_libs/3.5.2

And later

.libPaths("~/local/R_libs/3.5.2")
if (!require("remotes")) {
  install.packages("remotes")
}
remotes::install_github("jcrodriguez1989/rco")

and it worked. Thanks!