This quiz will help you practice what you learned in this weekend’s Datacamp assignment as well as what you saw in this weekend’s reading.
Group instructions: If you’re working with a partner and find yourself figuring out most of the code, please slow down and let your partner answer some. If you find yourself in the opposite position, please write comments for the code that explains (briefly) what it’s doing.
Start by opening R and creating a script. Copy paste the following lines of code to the top of your script
rm(list=ls())
# install.packages("tidyverse") # uncomment this line if necessary
library(tidyverse)
# install.packages("nycflights13") # ditto
library(nycflights13)
data <- nycflights13::flights
# answer variables
ans1 <- numeric(1) # a single number value that your script will update
ans2 <- character(1) # a string
ans3 <- character(1) # another string
################################################################################
############################### YOUR WORK BELOW: ###############################
################################################################################
# Update these variables
birthmonth <- 11 # your birth month as a number
birthday <- 24 # your birth day as a number
As you answer the questions, update your script so that:
ans1
.Hints:
na.rm=TRUE
argument.filter
, mutate
, and summarize
.Hints:
group_by
is going to make your life easier.select(origin) %>% as.character()
will help convert your work into an airline code instead of a dataframe.Hints:
nysflights13
will help you find details about airline names.full_join()
function to combine the dataframe with airline names to data
.Save your script using this naming convention:
"Q1_<first name>_<last name>.R"
For example, my submission would be “Q1-rick-weber.R”.
Upload your file to the appropriate place in Blackboard.
A perfect submission (one getting a check plus) will be set up so that if I run your script and then my grading script it will yield the following:
source("quiz1_rick_weber.R")
## `summarise()` ungrouping output (override with `.groups` argument)
## Joining, by = "carrier"
## `summarise()` ungrouping output (override with `.groups` argument)
source("grade_quiz1.R")
## [1] "Question 1 answer given:"
## [1] 20.52709
## [1] "Question 1 correct?"
## [1] TRUE
## [1] "Question 2 correct?"
## [1] TRUE
## [1] "Question 3 correct?"
## [1] TRUE
An earnest attempt will get a check (4/5 points). A non-attempt will get you 0/5 points. So submit something by the deadline.
The deadline is the end of today’s class. As long as you submit an earnest attempt by the deadline I will accept improved submissions until the end of the week allowing you to bump up your score. That is: if you turn in nothing by 3pm today, you get 0 points on this quiz. But if you turn in an imperfect submission you’ll get 4/5 and the option to resubmit for a (possible) 5/5.