我想用reshape2::dcast编写下面的tidyr::spread调用
stocks <- data.frame(
time = as.Date('2009-01-01') + 0:9,
X = rnorm(10, 0, 1),
Y = rnorm(10, 0, 2),
Z = rnorm(10, 0, 4)
)
stocksm <- stocks %>% gather(stock, price, -time)
stocksm %>% spread(time, price)我弄不清楚要传递给fun.aggregate的是什么
发布于 2015-01-21 05:17:02
您可以使用此方法:
library(reshape2)
dcast(stocksm, stock ~ time)https://stackoverflow.com/questions/28055222
复制相似问题