This is one of a series of posts where I document software configurations for personal reference. This post documents the configurations for R.
See my previous post for instructions on how to install R and some packages.
A few notes on R’s startup process
There’s a good post from rstudio that explains R’s startup process. The following figure from that post is especially relavant to the current post since it explains how R looks for various kinds of configuration files:
This post will concentrate on user- or project-specific files, so all the files mentioned below should be placed in a user’s home directory or in the working directory of a project.
R Environment variables
~/.Renviron and append the file with the following line:
~/.Rprofile and append the file with the following lines:
options( defaultPackages = c(getOption("defaultPackages"), "tidyverse"), tibble.print_max = 500, tibble.print_min = 50, tibble.width = 150 )
.Rprofile file in the working directory of a blog project created with
blogdown and append the file with the following lines:
options( blogdown.author = "zenggyu", blogdown.ext = ".Rmd", servr.daemon = TRUE )
Global Options -> General:
- Uncheck “Restore .RData into workspace at startup”.
- Set “Save workspace to .RData on exit” to “Never”.
- Uncheck “Always save history (even when not saving .RData)”.
- Redo ->
ctrl+y(by default, this shortcut is occupied by ‘paste last yank’).
- Reindent Selection ->
- Reformat Current Selection ->
ctrl+shift+f(by default, this shortcut is occupied by ‘find in files’).
- Show Help for Current Function ->
ctrl + e.
Some useful startup options
~/.bashrc and append the file with the following lines:
alias R='R --no-save --no-restore-data'
If a pre-loaded package (e.g.,
tidyverse) needs to be updated, run R in terminal with:
install.packages(c("tidyverse", "tidymodels", # meta packages "bookdown", "blogdown", "pagedown", "xaringan", # rmarkdown related "randomForest", "earth", "e1071", # machine learning "tsibble", "fabble", "feasts", # time series "DT", "gt", "gganimate", "ggrepel", "ggwordcloud", "GGally", # data visualization "odbc", "DBI", # database related "datapasta", # RStudio addons "caTools", "bitops", "remotes", "DescTools")) # misc blogdown::install_hugo()