Suggestions for how to smoothly get from foo to foo2 (preferably with tidyr or reshape2 packages)?
This is kind of like this question, but not exactly I think, becau
Here's another alternative using tidyr:
library(tidyr)
foo %>%
gather(key, value, -group, -times, -num_users) %>%
unite(col, key, times) %>%
spread(col, value)
Which gives:
# group num_users action_rate_after action_rate_before action_rate_c95_after
#1 a 100 0.15 0.1 0.06962893
#2 b 200 0.18 0.2 0.05297400
#3 c 300 0.35 0.3 0.05369881
# action_rate_c95_before
#1 0.05850000
#2 0.05515433
#3 0.05159215