Specifying which repos when using rscript

I've successfully written an R program in RStudio, and it includes "install.packages("sas7bdat")". My RStudio is configured to pull packages from "Global (CDN) - RStudio" as its primary CRAN repository.

When I run my program outside of RStudio, using /usr/local/bin/Rscript, the program fails because no default repos is specified.

The environment in which I'm using Rscript is ephemeral, so there's no persistent R Profile in which I might otherwise specify a default repos.

I can resolve the issue by coding "install.packages("sas7bdat", repos = "http://cran.us.r-project.org")" in my program, but I prefer to solve it with an Rscript option, if one is available. How might I influence Rscript with an option to specify the default repos?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.