MGSC 7000
PRACTICE QUESTIONS
Below is the preview of dataset named “GDPdata”
Answer the following three questions:
1. Complete the code below to get the median GDP for each country.
GDPdata %>% ___________ %>% summarize(__________)
2. Complete the code below to get the mean PerCapita in year - 2014 (i.e., we need average
PerCapita across all the countries for 2014).
GDPdata %>% ___________ %>% (__________)
3. Complete the code below to get the annual mean PerCapita (i.e., we need average
PerCapita across all the countries for each year).
GDPdata %>% ___________ %>% (__________)
Expected output:
4. You have a vector date as shown below
There are three elements in numeric format. We need to convert this vector to date
format. Complete the code below (use lubricate)
date <-_________
Expected output:
5. You have two vectors v1 and v2 as shown below:
Write a code to combine v1 and v2.
Expected output
学霸联盟学霸联盟