Creating a project-oriented workflow in R
Humboldt-Universität zu Berlin
Thu Aug 22, 2024
Today we will…
here
package4.4.0
, “Puppy Cup”R.version
2023.12.1.402
, “Ocean Storm”.Rproj
file in a project folderSoSe2024
or Mastersarbeit
File > New Project > New Directory > New Project > [Directory name] > Create Project
New RProject
Create a new RProject for this workshop
File > New Project > New Directory > New Project > [Directory name] > Create Project
.Rproj
file and double-clickProject (None)
drop-down (top right)File > New File > Markdown File
(not R Markdown!)
#
for headings, *italics*
, **bold**
)README.md
in your project directoryTools > Global Options
Global settings
Change your Global Options so that
data
: containing your dataset(s)scripts
(or analyses
, etc.): containing any analysis scriptsmanuscript
: containing any write-ups of your resultsmaterials
: containing relevant experiment materials (e.g., stimuli)data
and scripts
)data/
raw
sub-folderprocessed
or tidy
)scripts/
New script
Create a new Quarto script:
File > New File > Quarto Document
Use Visual Editor
boxCreate
scripts/
folder: File > Save as...
readr::read_csv()
here
-packagehere
package (Müller, 2020) enables file referencing
setwd()
setwd()
If the first line of your R script is
setwd("C:\Users\jenny\path\that\only\I\have")
I will come into your office and SET YOUR COMPUTER ON FIRE🔥.
here()
here
here::here()
here
functionhere
function without loading the packagedf_
df
stands for dataframefit_
for models, fig_
for figures, sum_
for summaries, tbl_
for tables, etc.Reproduce your analysis
names()
, summary()
, dplyr::glimpse()
, whatever you typically do)Today we learned…
here
✅SSOL 2024