Saving the source and blank slates
library(tidyverse) library(here) set.seed(1234) theme_set(theme_minimal()) Save source, not the workspace Your workspace in R is the current working environment. It includes any libraries you have loaded using library(), any user-defined objects (e.
library(tidyverse) library(here) set.seed(1234) theme_set(theme_minimal()) In saving the source and blank slates, we discouraged the habit of starting R scripts with rm(list = ls()), because it doesn’t actually achieve the intended goal: to reset things.
Use safe filepaths
library(tidyverse) set.seed(1234) theme_set(theme_minimal()) How can you avoid setwd() at the top of every script? Organize each logical project into a folder on your computer. Make sure the top-level folder advertises itself as such.
A dive into R Markdown
Run the code below in your console to download this exercise as a set of R scripts. usethis::use_course("cis-ds/a-deep-dive-into-quarto") These notes are undergoing revisions to be updated for Quarto documents.
R startup procedures
library(tidyverse) set.seed(1234) theme_set(theme_minimal()) R offers the ability to customize its startup procedures. That is, every time an R process is initiated, users can define custom R code to evaluate before the session begins.
Recovering from common Git predicaments
I don’t want a bunch of these files committed Which files should you commit in your Git repository, and which files are safe to ignore? What you should commit Source files - things like R Markdown (.