-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexercise2.R
42 lines (17 loc) · 1.09 KB
/
exercise2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
### Exercise 2 ###
# Using the "setwd" function, set your working directory as the directory of your repository
# Read in the female baby names csv file into a variable called "female_names"
# Create a vector "year" as the year column of the dataset
# Create a vector "name" as the name column of the datset
# As in the last exercise, you'll need to convert this column to a vector
# Create a vector "prop" as the proportion column of the dataset
# Create a vector "names_2013" as your name vector where your year vector is 2013
# Create a vector "prop_2013" as the your prop vector where your year vecctor is 2013
# What was the most popular female name in 2013?
# Write a funciton "most_popular" that takes in a value "my_year", and returns
# a sentence stating the most popular name in that year. Note how you had to make intermediary variables above.
# What was the most popular female name in 1994?
### Bonus ###
# Write a function "how_popular" that takes in a name and a year, and returns
# a sentence with how popular that name was in that year
# How popular was the name 'Laura' in 1995