dplyr mutate in zoo object

假如想象 提交于 2019-12-05 19:33:06

zoo has a transform method:

library(zoo)
z <- zoo(cbind(a = 1:3, b = 4:6))

transform(z, a = a + 1, c = a + b)

giving:

  a b c
1 2 4 5
2 3 5 7
3 4 6 9

or using z from above, the following gives the same result:

library(magrittr)
z %>% transform(a = a + 1, c = a + b)

Next time please provide sample code, inputs and expected outputs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!