diff --git a/Notes.md b/Notes.md index 2ee76fa..cdb5364 100644 --- a/Notes.md +++ b/Notes.md @@ -149,12 +149,15 @@ git config --local --list * Note: The file must be saved before the option to install is shown. * Note: The R session may need to be restarted. Do this with * "Session" -> "Restart R" - * Remember to "Open Project" for theproject when starting a new environment. - * Libraries can be installed with a `Setup.Rmd` file. - * `setup.Rmd` must be run once every time you start a new environment (start a Juypter Lab instance) (this can be different on other systems). - * See [Setup.Rmd](prep/Setup.Rmd) for an example. + * Libraries can be installed with a `setup.R` file. + * `setup.R` must be run once every time you start a new environment (start a Juypter Lab instance) (this can be different on other systems). + * See [Setup.R](prep/Setup.R) for an example. * Do not include `install.packages()` in your R Markdown files (other than `Setup.Rmd) as the R Markdown file is run every time it is displayed with "Knit" and will re-install the packages every time. - * By default libraries are not saved when restarting the environment. + * By default libraries are not saved when restarting the environment. You can change the save path by creating a `.Renviron` file in the project directory (remember to Restart R) with the following contents: +```bash +R_LIBS_SITE=~/work/R +``` + * Remember to "Open Project" for the project when starting a new environment. ## Technical Notes diff --git a/prep/Setup.Rmd b/prep/Setup.Rmd deleted file mode 100644 index 76742bb..0000000 --- a/prep/Setup.Rmd +++ /dev/null @@ -1,28 +0,0 @@ ---- -output: html_document -editor_options: - chunk_output_type: console ---- -# Setup RStudio - -Run this R Markdown notebook once in an environment to install packages. Watch the console output for messages as they are not shown in Viewer. - -Configure mirror -```{r message=FALSE, warning=FALSE} -options(repos = list(CRAN="http://cran.rstudio.com/")) -``` - -Setup basic packages -```{r message=FALSE, warning=FALSE} -install.packages(c("tidyverse", "lubridate", "ratdat")) -``` - -Packages from Lesson 1 -```{r message=FALSE, warning=FALSE} -install.packages("ggplot2") -``` - -Packages from Data Lesson -```{r message=FALSE, warning=FALSE} -install.packages(c("dbplyr", "RSQLite")) -``` diff --git a/prep/setup.R b/prep/setup.R new file mode 100644 index 0000000..28dd549 --- /dev/null +++ b/prep/setup.R @@ -0,0 +1,8 @@ +# Setup RStudio +# Run this R script only once in an environment to install packages. + +options(repos = list(CRAN="http://cran.rstudio.com/")) + +install.packages(c("tidyverse", "lubridate", "ratdat")) +install.packages("ggplot2") +install.packages(c("dbplyr", "RSQLite"))