Skip to content

Instantly share code, notes, and snippets.

@EmZhu
Last active August 16, 2016 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmZhu/b7d8fdf843ede894d990fb3af78c0648 to your computer and use it in GitHub Desktop.
Save EmZhu/b7d8fdf843ede894d990fb3af78c0648 to your computer and use it in GitHub Desktop.
#================================population per name
population_per_name = data.frame(Year = selected_years)
population_per_name$Ratio = population$Change / (filtered_national %>% group_by(Year) %>% summarise(Count = n_distinct(Name)))$Count
ggplot() +
geom_line(data=population_per_name, aes(Year, Ratio),color='purple') +
ylab('Population per name (in thousands)') +
ggtitle('Population per name') +
ylim(0, round_any(max(population_per_name$Ratio), 10000, f=ceiling))
(max(population_per_name$Ratio) - min(population_per_name$Ratio)) / max(population_per_name$Ratio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment