AMOUNTS
MPA 635: Data Visualization September 25, 2018
AMOUNTS MPA 635: Data Visualization September 25, 2018 P L A N F - - PowerPoint PPT Presentation
AMOUNTS MPA 635: Data Visualization September 25, 2018 P L A N F O R T O D A Y More on truth Amounts Verbs Live example M O R E O N T R U T H D A T A A N D W H I T E L I E S I secretly wonder if I'm a righteous dude, is it OK
MPA 635: Data Visualization September 25, 2018
Anonymous MPA 635 student
↑ Don’t perpetuate this ↑
Choose rows based on conditions
Choose (and rename) columns
Add column (or change existing column)
Make subgroups based on a column
Calculate summary statistics for groups
gapminder %>% filter(year == 1967)
gapminder %>% filter(lifeExp < 40)
gapminder %>% filter(continent == "Asia", lifeExp < 40)
gapminder %>% select(country, year, pop)
gapminder %>% mutate(something_new = 5)
gapminder %>% mutate(pop_million = pop / 1000000)
gapminder %>% mutate(lifeExp_binary = ifelse(lifeExp < 40, "Very low", "Not very low"))
gapminder %>% group_by(continent) %>% summarize(avg_lifeexp = mean(lifeExp), median_lifeexmp = median(lifeExp), num_countries = n())
gapminder %>% group_by(continent, year) %>% summarize(avg_lifeexp = mean(lifeExp), median_lifeexmp = median(lifeExp), num_countries = n())
Sort a data frame by a column
Merge two data frames by column(s)
group_by() %>% summarize(n = n())
Make a data frame long
Make a data frame wide