RStudio
Week 1
Overview
- Read the syllabus
- Install R
- Install RStudio
- Go through the videos linked below.
- Review the week 1 slides
- Attend the lab session to go through the Lab Component of Homework 1.
- Complete Homework 1
This week I will introduce the course and our approach for the term. We will also introduce RStudio and go through some basic hands-on tasks that will be reinforced in the labs this week.
RStudio Cloud
If for some reason you are not able to install R and RStudio on your own computer, there is another option, a cloud-based version of RStudio that you can access using your web browser: Posit Cloud. There is a free version of it and also paid versions that provide more compute resources if you need them.
It is better for you to have R and RStudio installed on your own computer but Posit Cloud is there as another option if you need it.
Videos
RStudio basics
Open up RStudio on your computer and watch this video by Matt Crump:
You should be able to answer the following questions:
- Do you know where the console is, and what it does?
- Do you know where the editor window is and what it does.
- Do you know the difference between writing code in the editor in window, and running code in the console?
- What is the environment tab, and what does it show you?
- How to clear the workspace
- What is the files tab, and what does it show you?
- How to copy a file
- How to rename a file
- How to move a file
R scripts & R Markdown files
Open up RStudio on your computer and watch this video:
You should be able to answer the following questions:
- Make a new R markdown file
- Delete the template to start fresh
- Save your R markdown file
- Add some notes and code to the file
- know how to make an R code block
- Knit the file
- Know how to set eval=FALSE so the code bock does not run
- Know how to set echo=FALSE to the code block is not displayed
- Add comments to a code block
- Make a new R script
- add code to an r script
- add comments to an r script
- save an r script
- run code from an r script
Basic R stuff
Open up RStudio on your computer and watch this video:
You should be able to answer the following questions:
- Do basic math with R
- Store a number in a variable
- Store a string in a variable
- Store multiple numbers in a variable
- Store multiple strings in a variable
- Index a particular location in a variable
- Replace a particular value in a variable at a particular location
- Do basic math with numbers in variable.
- Hot key for running a line a code
- Copy and paste code into console and press enter
- press play in Rmd file to run code in code block
- Select any number of lines and run code using hot key
R packages
Open up RStudio on your computer and watch this video:
You should be able to answer the following questions:
- Know how to install an R package
- Know how to load a package using library()
- Know how to load a package by clicking it in the packages a tab
- Understand why knitting would fail if you did not load a library you need in your .rmd file.