Say I have a data frame where one column is some repeating value (dates, IDs, etc). Is there a way to convert a data frame into a now data frame with columns instead of rep
Using your data frame d,
library(tidyr)
> spread(d, key = b, value = c)
a aa bb cc
1 1 30 50 50
2 2 45 35 40
3 3 30 40 40
4 4 50 40 50
5 5 50 20 40
6 6 20 50 40
7 7 35 25 35
8 8 50 20 40
9 9 35 30 30
10 10 35 50 25
Explanation, the argument key = b lets you specify a column in your data frame. spread will create a new column for each unique entry in the key column b. The argument value = c tells spread to retrieve the value in column c and write it in the corresponding new key column.