Skip to content

Instantly share code, notes, and snippets.

@yvlau92
Created February 6, 2017 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yvlau92/d326a2d3ec129f68c0795835ad7246a7 to your computer and use it in GitHub Desktop.
Save yvlau92/d326a2d3ec129f68c0795835ad7246a7 to your computer and use it in GitHub Desktop.
# n_infractions: numbers of infractions committed at a particular date of inspection
closure_n_infractions <- closure %>%
group_by(camis,date) %>%
summarise(n_infractions = n())%>%
arrange(desc(n_infractions))
# n_closures: number of closures a restaurant has had within the past 5 years.
closure_n_closures <- closure_n_infractions %>%
group_by(camis)%>%
summarise(n_closures = n())%>%
arrange(desc(n_closures))
# days_diff: number of days a restaurant took to reopen after being closed by the Health Department
dates_diff <- overall_unique_closed_noreclose %>%
group_by(camis)%>%
mutate(days_diff = date[action=='closed'][1] - date[action=='reopened'][1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment