本文介绍了dootr在动物园对象中变异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在 zoo
对象中应用 dplyr mutate
。但是,它产生一个错误:
I was trying to apply the dplyr mutate
in zoo
object. But, it generated an error:
Error in UseMethod("mutate") :
no applicable method for 'mutate' applied to an object of class "zoo".
我googled,看到它还没有解决。最近的一个讨论是。
I googled and saw that it has not been yet resolved. A recent discussion on this is here.
如果有任何人可以在这方面帮助我,我将不胜感激。
I would appreciate if any one could help me in this regard.
推荐答案
动物园有一个变换
方法:
library(zoo)
z <- zoo(cbind(a = 1:3, b = 4:6))
transform(z, a = a + 1, c = a + b)
给:
a b c
1 2 4 5
2 3 5 7
3 4 6 9
或使用以上的 z
给出相同的结果:
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.
这篇关于dootr在动物园对象中变异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!