Preface
How to use this book
Before we begin
Week 1. Part 1
1
Welcome to R!
1.1
A look around RStudio
1.2
Console Pane
1.3
Environment/History Pane
1.4
Plotting Pane
1.5
Open a new R script
1.6
Comments
1.7
Executing commands
1.8
Simple maths in R
1.9
Help!!
1.10
Variables
1.10.1
A note on variables
1.11
Vectors
1.11.1
Creating numeric vectors
1.11.2
Character vectors
1.11.3
Logical vectors
1.12
Packages
1.12.1
Installing packages
1.13
The pipe %>%
1.14
Data frames
Week 1. Part 2
2
Making beautiful plots
Introductory information
ggplot2. A grammar of graphics
2.1
Building a ggplot
2.2
Plot background
2.3
Aesthetics aes()
2.4
Geometric representations geom()
2.4.1
A note about %>% and +
2.5
Adding colour
2.6
Adding layers
2.7
Facets
2.8
Coordinate space
2.9
Axis labels
2.10
Themes
Week 1. Part 3
3
Making
more
beautiful plots
Introductory information
3.1
Big(ger) Data: 54,000 diamonds
3.2
geom_jitter()
3.3
Summary plots
3.3.1
Free examples!
3.4
Histograms
3.5
Density plots
3.6
Box plots
3.7
Saving plots
3.8
Challenge
3.9
Solution
Week 2. Part 1
4
Sub-setting vectors
4.1
Subset by position
4.2
Adding names
4.3
Subset by condition
4.4
Challenge
4.5
Possible solutions
Week 2. Part 2
5
Manipulating data with dplyr
5.1
filter()
5.1.1
Logical operations
5.1.2
str_detect() helper function
5.1.3
%in% helper
5.1.4
is.na() helper
5.1.5
complete.cases() helper
5.2
select()
5.2.1
contains() helper function
5.2.2
starts_with() helper function
5.2.3
everything() helper function
5.3
arrange()
5.3.1
desc() helper function
5.4
Chaining dplyr functions
5.5
Writing data to a file
5.6
Chaining dplyr and ggplot
5.7
mutate()
5.7.1
Challenge
5.7.2
Solution
5.7.3
ifelse() helper
5.7.4
case_when() helper
5.8
summarize()
5.8.1
n() helper
5.9
group_by() helper
5.9.1
group_by() %>% summarize()
5.9.2
group_by() %>% mutate()
5.9.3
ungroup() helper
5.9.4
count() helper
5.9.5
sample_n() helper
5.10
Challenges
5.11
Solutions
5.12
Summary
5.13
Cheat sheets!
5.13.1
ggplot example
5.13.2
dplyr example
5.14
Extra resources
Week 3
6
Reading, tidying & joining data
6.1
Reading in data
6.1.1
read_excel()
6.1.2
read_csv()
6.1.3
read_delim()
6.1.4
read_tsv()
6.2
Reshaping data
6.2.1
pivot_wider()
6.2.2
pivot_longer()
6.3
Separating and uniting columns
6.3.1
separate()
6.3.2
separate_rows()
6.3.3
rename()
6.3.4
unite()
6.4
Removing variables
6.5
Joining dataframes
6.5.1
left_join()
6.6
Plotting challenge
6.7
Solution
6.8
Summary
Week 4. Part 1
7
Automating your work
7.1
Experimental design
7.2
For loops
7.3
paste()
7.4
Catching loop results
7.4.1
Catch in vector
7.4.2
Catch in data frame
Week 4. Part 2
7.5
Analyse Plate 1
7.6
Plotting the data
7.6.1
str_remove() helper
7.6.2
as.numeric() helper
7.7
Statistical summary
7.7.1
pull()
7.8
Identify hits
Week 4. Part 3
7.9
list.files()
7.10
Extract filenames
7.11
Variable inputs & outputs
7.12
Looping through plates
Factors
8
What the factor?
8.1
Factors in plots
8.1.1
Factors and facets
8.1.2
Factors and bar charts
8.1.3
Reordering gene plots
8.2
Summary
Odds & Ends
Introduction to R - tidyverse
Week 2. Part 1