Skip to content

Instantly share code, notes, and snippets.

@apreshill
Created November 29, 2018 03:58
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 apreshill/3ac1c806012426420fe485625e347ad8 to your computer and use it in GitHub Desktop.
Save apreshill/3ac1c806012426420fe485625e347ad8 to your computer and use it in GitHub Desktop.
library(tidyverse)
msleep <- msleep %>%
select(name:order)
msleep
msleep %>%
add_count(vore) %>% # n = vores
count(vore, order, n) %>% # nn = unique orders per vore
mutate(prop_order = nn / n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment