2 ms·
I'm not sure exactly what you mean by 2 keys. Is it two key/value pairs or hierarchal 2 keys per value? If it is 2 keys per value, you can simply `unite()` the
by wodenokoto 9y ago
I'm not sure exactly what you mean by 2 keys. Is it two key/value pairs or hierarchal 2 keys per value?
If it is 2 keys per value, you can simply `unite()` the key columns.
If it is two sets of key/values you simply spread twice.
`df %>% spread(key1, val1) %>% spread(key2, val2)`
tidy og dplyr are very much about composing things, so you do have to think a bit outside of the box of "which function" to use and rather "which functions" to use.