QCBS R Workshop Series
Preface
0.1
Code of conduct
0.1.1
Expected behaviour
0.1.2
Unacceptable behaviour
0.2
Contributors
0.3
Contributing
Loading and manipulating data in
R
1
Learning objectives
2
Preparing for the workshop
3
RStudio Projects
3.1
Create a new project
3.2
Keep your files organized
3.3
Preparing data for R
3.3.1
Naming files
3.3.2
Naming variables
3.3.3
Common data preparation mistakes
3.3.4
Bad data examples
4
Writing a script
4.0.1
Creating an R script
4.0.2
Commands & Comments
4.0.3
Header
4.0.4
Section Heading
4.0.5
Housekeeping
4.0.6
Important Reminders
5
Loading, exploring and saving data
5.0.1
Working directory
5.0.2
Display the content of the working directory
5.0.3
Importing data
5.0.4
Looking at data
5.0.5
Reminder from workshop 1: Accessing data
5.0.6
Renaming variables
5.0.7
Creating new variables
5.0.8
Subsetting data
5.0.9
Data exploration
5.0.10
Save your workspace
5.0.11
Exporting data
5.0.12
Use your data CHALLENGE
6
Repairing a Broken Data Frame
6.0.1
Fix a broken dataframe
7
Manipulate data with the tidyverse
7.0.1
Using tidyr to reshape data frames
7.0.2
Why “tidy” your data?
7.0.3
Wide vs. long data
7.0.4
pivot_longer(): Making your data long
7.0.5
pivot_wider(): Making your data wide
7.0.6
A
tibble
structure for your data
7.0.7
separate(): Separate two (or more) variables in a single column
7.0.8
Recap: tidyr
7.0.9
tidyr CHALLENGE
7.0.10
Solution
7.0.11
tidyr CHALLENGE 2
7.0.12
Solution
7.1
Data manipulation with dplyr
7.1.1
Intro to dplyr
7.1.2
Select a subset of columns with
select()
7.1.3
Select a subset of rows with
filter()
7.1.4
Sorting rows with
arrange()
7.1.5
Create and populate columns with
mutate()
7.2
dplyr and magrittr, a match made in heaven
7.3
dplyr - grouped operations and summaries
7.3.1
dplyr & magrittr CHALLENGE
7.3.2
Solution
7.3.3
dplyr & magrittr NINJA CHALLENGE
7.3.4
Ninja hint
7.3.5
Solution
7.4
dplyr - Merging data frames
Final considerations
8
Summary
9
Additional resources
10
References
QCBS R Workshop Series
Workshop 2: Loading and Manipulating Data
Chapter 8
Summary
R is…
In the next workshop, …