问题描述
限时送ChatGPT账号..我有一个名为 A
的 ffdf
对象,带有 (dim=c(26416266,25))
.我正在尝试将时间变量 (D_Time)
从 Factor
类型转换为 Time
,以便我可以执行 summary()
并获取D_Time
的最小值、最大值、平均值和中值
.
I have a ffdf
objects named A
with (dim=c(26416266,25))
. I'm trying to convert the Time variable (D_Time)
from type Factor
to Time
, so that I can perform summary()
and get the min, max, average and median
for D_Time
.
D_Time
示例如下:
> D_Time
1 07:40
2 08:01
3 02:24
4 08:15
5 01:45
6 04:56
7 02:12
8 07:35
9 05:48
10 11:50
我已尝试将 A
更改为 dataframe
并使用 chron
进行转换,但我的内存不足.我尝试使用 chron
, POSIXlt
但不断收到错误消息.我也尝试将 :00
粘贴为 ss
以制作 hh:mm:ss
格式,但仍然没有运气.
I have try to change A
to dataframe
and convert it using chron
but my memory is running out. I try to use chron
, POSIXlt
but keep getting error message. I also try to paste :00
as ss
to make the format hh:mm:ss
but still no luck.
我想知道,有没有办法做到这一点?提前致谢.
I'm wonder, is there any way to do this? Thanks in advance.
推荐答案
感谢@jwijffels 提供此解决方案:
Credit to @jwijffels for this solution:
A$D_DateTime <- with(A, as.POSIXct(paste(D_Date, D_Time, sep=" "), format = "%Y-%m-%d %H:%M"), by = 250000)
这篇关于在 R 中将 FFDF 对象的因子更改为时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论