Skip to content

Instantly share code, notes, and snippets.

@klmr

klmr/summarize.r Secret

Last active August 28, 2018 09:03
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 klmr/8272092170d0b19d98e5eb44fc9cec9f to your computer and use it in GitHub Desktop.
Save klmr/8272092170d0b19d98e5eb44fc9cec9f to your computer and use it in GitHub Desktop.
Summarise a simple table in < 5 lines of code #so
readr::read_csv(input_filename) %>%
dplyr::group_by(drug_name) %>%
dplyr::summarize(num_prescriber = n(), total_cost = sum(drug_cost)) %>%
readr::write_csv(output_filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment