Last active
July 31, 2018 16:57
-
-
Save alexpghayes/d66bdd4c3e05b93282a80b71479ee679 to your computer and use it in GitHub Desktop.
irene's example of how to undo model.matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data <- tibble(species = c("raccoon", "kakapo", "bedbug"), | |
weight_f = c(10, 3, .1), | |
weight_m = c(11, 5, .1), | |
height_f = c(11, 11, .2), | |
height_m = c(10, 10, .1)) | |
data %>% | |
gather(key, value, -species) %>% | |
separate(key, c("meas", "sex")) %>% | |
spread(meas, value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment