gpt4 book ai didi

r - POSIXct和plyrmr

转载 作者:行者123 更新时间:2023-12-02 21:32:28 24 4
gpt4 key购买 nike

为什么POSIXct对象不能与plyrmr包一起使用?这是我的代码:

filename2 <- "/user/sgerony/mtcars"
complex.function = function(x){
as.data.frame(mutate(x,date.time=as.POSIXct("2014-01-01 03:15")))
}
magic.wand(complex.function)

mtcars %|% complex.function()

结果:
    mpg cyl  disp  hp drat    wt  qsec vs am gear carb           date.time
1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 2014-01-01 03:15:00
2 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 2014-01-01 03:15:00
3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 2014-01-01 03:15:00
4 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 2014-01-01 03:15:00

等等..
input(mtcars) %|% complex.function()

结果:
Error in mr(map = map, reduce = reduce, combine = combine, vectorized.reduce,  : 
hadoop streaming failed with error code 1

谢谢!

最佳答案

不幸的是,plyrmr不支持这种类型的cols。我对其他地方相同问题的回答是不正确的,但在那里您一并提出了8个问题,在这里您提供了更多详细信息。我建议将posixct表示为字符串,作为一种解决方法,然后将其转换为posixct进行时间相关的操作。

关于r - POSIXct和plyrmr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33752447/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com