Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which is the best way to install R packages? #25

Open
brorio opened this issue Nov 3, 2018 · 4 comments
Open

Which is the best way to install R packages? #25

brorio opened this issue Nov 3, 2018 · 4 comments

Comments

@brorio
Copy link

brorio commented Nov 3, 2018

On the Amazon AMI I can install from inside R, but then I have this problem:
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
Warning in install.packages("jsonlite", repos = "http://cran.r-project.org") :
'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead? (y/n)

I can install it this way also:
wget https://cran.r-project.org/src/contrib/jsonlite_1.5.tar.gz
sudo R CMD INSTALL jsonlite_1.5.tar.gz

which probably is the best way, or run R as sudo..

@MikeBadescu
Copy link
Member

Packages to be installed are supposed to be listed in the variable R_PACKAGES (originally defined in settings_default.sh).

The code to install them is located in the second part of the script 11_install_packages.sh which indicates the lib path, etc.

@brorio
Copy link
Author

brorio commented Nov 6, 2018

Yes, I read the code in all the files under /scripts, but I could not find out how exactly how it's supposed to work and which syntax to use.

@MikeBadescu
Copy link
Member

how exactly how it's supposed to work

In setup_user.sh define a variable R_PACKAGES as shown in settings_default.sh. For example:

# do not use commas or quotes, leave spaces before and after each package name
R_PACKAGES=( jsonlite purrr digest )

Then, you can run the main script 01_main.sh.

If you want to use the auto-setup, run any of scripts 21_setup_vpc.sh, 22_setup_custom_ami.sh, 23_setup_s3.sh, 24_setup_lambda.sh, as needed before runnig the main script.

@brorio
Copy link
Author

brorio commented Nov 6, 2018

Great! Thanks! I only intend to use 11 and 12 (or if it was 13..). Then shut the EC2 down and develop on my local computer with AWS SAM. I already have aws-sam-cli, R and Python on my Mac, so I just have to invoke the phyton lambda to see that it works and then deploy it.

Unfortunately, the python aws sam has bugs that stop that scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants