1 Week 1
2 Welcome to coding in R!
This week we are going to start by getting familiar with RMarkdown and end up reading some data into RStudio. There are a total of 10 videos to watch and each video is 10-15 min long so you can dip in and out across the week.
The idea is for you to code along with the videos, stopping and starting and troubleshooting as you go. Try the exercises Danielle recommends AND to see whether you are really getting it, have a go at the SELF TEST challenge.
For this reason, you should allocate ~ 3 hours to your coding this week.
NOTE: Your first learning log should include a knitted .Rmd document published to Rpubs. Don’t know what that means? no problem! Danielle covers how to do that in the sharing your document video (video 7) below.
2.1 Resources
2.2 Learning outcomes
By the end of this module you will be able to…
- Find your way around RStudio and RMarkdown
- Read data into RStudio
- Use the pipe (%>%) to string together group_by and summarise commands
- Write data to a .csv file
2.3 Getting started in RMarkdown
2.3.1 The beginning
In this video, Danielle shows you how to set up an RStudio Cloud account and gives a brief intro of RMarkdown.
2.3.2 Stating the problem
In this video, Danielle talks about why word documents can be problematic and why Markdown is a good solution if you want to write about science reproducibly. She also shows you how to create a new RStudio Cloud project.
2.3.3 Starting markdown
In this video, Danielle shows you how to create a plain Markdown document and create some text. She shows you how to format your text with bold and italics, make lists, and add headings.
2.3.4 More markdown
In this video, Danielle shows you how to insert hyperlinks, block quotes, and nested lists into your plain Markdown document.
2.3.5 RMarkdown
In this video, Danielle shows you how to use RMarkdown. She shows you how to insert both text and R “chunks” and “knit” your document.
2.3.6 Custom documents
In this video, Danielle shows you how to edit the yaml to change the kind of document that your Rmd knits to. She shows you how to knit to pdf, change the theme of your document and include a table of contents.
2.3.7 Inserting equations & sharing your document
In this video, Danielle shows you how to use LaTex to insert equations into your Rmd . She also shows you how to share your knitted document by publishing to RPubs.
2.4 Say hello to data
Now that you have your head around RMarkdown, lets get some data into R.
2.4.1 Read and glimpse your data
In this video, Danielle introduces the “reasoning” data set that she will go on to use in upcoming videos, talks about how to read data into R using read_csv()
and view it with print()
and glimpse()
2.4.2 What is the “pipe”?
The pipe operator is a key component of the tidyverse. Here Danielle introduces the pipe along with some examples using group_by()
and summarise()
.
2.4.3 How to write data
A quick wrap up of the section, an example of using write_csv()
, and pointers to more resources.