Answer the questions from lecture:
What is the difference between fct_relevel()
and fct_recode()
?
What is the difference between fct_collapse()
and fct_lump()
?
What is the difference between fct_reorder()
and fct_inorder()
?
Feel free to share answers with your classmates in the Discord server, to make sure you understand.
In your colleges_clean dataset, adjust the REGION
variable to have nicer or clearer labels and/or better categories.
Answer the questions from lecture:
What is the difference between length()
and str_length()
?
What is the difference between str_replace()
and str_replace_all()
?
What is the difference between str_trim()
and str_trunc()
?
What is the difference between str_sub()
and str_subset()
?
What does the collapse
argument do in str_c()
?
Feel free to share answers with your classmates in the Discord server, to make sure you understand.
Using your colleges_clean dataset, answer these questions:
Question 1: How exactly does Cal Poly’s name appear in this dataset?
Question 2: How many colleges have the word “University” in their name?
Question 3: Which college has the longest name? The shortest name?
A more in-depth discussion of the POSIXlt and POSIXct data classes.
A tutorial on lubridate - scroll down for details on intervals if you have trouble with %within%
and %--%
What is the difference between year()
and years()
and dyears()
?
What time zone does R think dates are in, by default?
What is the difference between %within%
and %--%
?
What happens if you use the parse_datetime()
function, but you do not provide a day
argument?
Question 1: Warm-up
Answer the following using code (even if you know the answer already).
Save your birthday as a Datetime object in R.
What day of the week does/did your birthday fall on in 2020?
On what day of the week should you plan your 100th birthday party?
Find the date that is exactly 9 months before your birthday. If it falls on a holiday, think about the implications.
Question 2: Your Zodiac sign
Download the zodiac.csv
data from the course website. This dataset gives the date ranges for the 12 Zodiac signs; that is, if you were born between the dates listed, you are affliated with that particular sign.
Use this dataset, and your new skills with DateTimes, to determine your sign using only code.