library(tidyverse)
## ── Attaching packages ──────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.1 ✔ purrr 0.3.3
## ✔ tibble 2.1.3 ✔ dplyr 0.8.3
## ✔ tidyr 1.0.0 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ─────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
In class we imported the survey data using the read.table()
function. (Note: on Homework 1 you’ll be asked to use the read.csv()
function instead.)
This is the code we used:
survey <- read.table("http://www.andrew.cmu.edu/user/achoulde/94842/data/survey_data2020.csv", header=TRUE, sep=",")
# Edit me
# Edit me
# Edit me
# Edit me
# Edit me
select()
function.# Edit me
filter()
and select()
together to get the Program
and Rexperience
of every student who watched at least 10 hours of TV last week.# Edit me
Try re-running as much of the lecture code as you have time for, taking time to understand what is happening in each line of code.
Tip: Instead of copying and pasting code, practice typing it yourself. This will help you to learn the syntax.
# Edit me (optional)