[1] 20
[1] 5
The essentials of R
2025-11-26




Organizing Projects for Reproducibility
data/, code/, results/ folders for logical organization.Sample Project Structure
project_directory/
├── data/ # Raw and processed datasets
├── code/ # Code files for data processing
├── results/ # Generated results, plots, and reports
├── README.md # Overview of the project structure and purpose5, or a)c(1, 2, 3))Use <- or =
It’s a collection of numbers, arithmetic expressions, logical values or character strings for example. Within a table, it could be a row or a column
It’s a tabular arrange of vectors (i.e. 2-dimensional, rectangular). Structure used to store values of any data type. The most common way to store data in R.
It’s a modern version of a data frame. It’s a data frame with class tbl_df and tbl and it only prints the first 10 rows and all the columns that fit on the screen.
A collection of elements of the same data type (numeric, character, or logical) arranged into a fixed number of rows and columns.
A generic object consisting of an ordered collection of objects.
Lists are one-dimensional, but heterogeneous data structures.
The list can be a list of vectors, matrices, characters, functions, etc…
A list is a vector that can contain heterogeneous elements.
Statistical model outputs are typically lists.
mean(), sum()Tip
An argument is a value you pass to a function when calling it.
A package is a collection of R functions, data sets, and compiled code in a well-defined format.

There are currently 23,052 of packages (on CRAN only).

The “tidy data” framework changed the way we code and work in R for data science. Tidy datasets are easy to manipulate, model and visualize, and have a specific structure:
Each variable is a column,
Each observation is a row, and
Each value have its own cell.
Tidy-data structure. Following three rules makes a dataset tidy: variables are in columns, observations are in rows, and values are in cells (Wickham, 2017).

acorrend@uoguelph.ca Adrian A. Correndo
Assistant Professor
Sustainable Cropping Systems
Department of Plant Agriculture
University of Guelph
Rm 226, Crop Science Bldg | Department of Plant Agriculture Ontario Agricultural College | University of Guelph | 50 Stone Rd E, Guelph, ON-N1G 2W1, Canada.
![]() |
||
![]() |
![]() |