# Analysis of tree growth data
# Author: Selina Baldauf
# Date: 2026-03-09
library(tidyverse)
# set defaults
input_file <- "data/tree_growth.csv"
# read input
trees <- read_csv(input_file)
# analyse data
summary(trees)Day 1 - Introduction to Data Analysis with R
Freie Universität Berlin - Theoretical Ecology
October 17, 2026
… can make even small changes frustrating and difficult.
Consistent structure and filenames
data/raw for the original datadata/clean for cleaned data created by your scriptsREADME.md) in which you document the project structureMyProject/
├── data/
│ ├── raw/
│ └── clean/
├── R/
├── figures/
├── MyProject.Rproj
└── README.md
Example RStudio project structure
MyProject/
├── data/
│ ├── raw/
│ │ └── 2026-10-12_growth-assay.csv
│ └── clean/
│ └── growth-assay_clean.csv
├── R/
│ ├── 01_clean-data.R
│ ├── 02_fit-models.R
│ └── 03_make-figures.R
└── figures/
└── linear-model-fit.png
Good practice R coding
library() calls on topCtrl/Cmd + Shift + Rsnake_case for longer variable namesTry to limit your line width to 80 characters.
Do I really have to remember all of this?
Luckily, no! R and R Studio provide some nice helpers
RStudio has style diagnostics that tell you where something is wrong
Tools -> Global Options -> Code -> Diagnostics
RStudio can automatically format your code!
Try it now: open your script from today and use Code -> Reformat Code to auto-format it.
… allow you and others to work productively.
But don’t get overwhelmed by all the advice. Just start with one thing.
Selina Baldauf // Good practice R coding