我有以下格式的数据。此处粘贴的示例数据。它基本上有 3 个变量开始时间、结束时间和这些时间戳之间的一组值。采样率为 64Hz
现在我需要以下格式的输出,两个连续邮票之间的差异为 0.0156(因为采样率为 64 Hz)
我尝试了 Seq 函数的各种方法,但没有成功
样本数据:
data1 <- read.table(sep="\t", text="
start end value
2019-04-05 19:14:44 2019-04-05 19:14:46 12.434,12.422,12.422,12.434,12.422,12.41,12.41,12.41,12.398,12.398,12.387,12.375,12.352,12.352,12.363,12.34,12.34,12.328,12.293,12.316,12.305,12.305,12.293,12.293,12.305,12.293,12.305,12.281,12.293,12.293,12.188,12.094,9.023,9.258,9.855,10.043,10.184,10.313,10.395,10.477,10.535,10.547,10.512,10.324,10.078,10.16,10.488,10.676,10.816,10.77,10.711,10.582,10.371,10.594,10.758,10.863,10.922,10.805,10.898,10.945,11.016,11.063,11.871,12.012,12.023,12.023,12.023,12.035,12.023,12.047,12.047,12.047,12.059,12.059,12.07,12.082,12.082,12.07,12.059,12.07,12.094,12.094,12.059,12.094,12.105,12.094,12.105,12.094,12.105,12.105,12.129,12.105,12.117,12.117,12.105,12.117,12.117,12.105,12.105,12.117,12.129,12.117,12.129,12.129,12.129,12.129,12.117,12.141,12.141,12.141,12.141,12.141,12.141,12.141,12.129,12.141,12.152,12.141,12.141,12.141,12.141,12.141,12.164,12.164,12.141,12.141,12.164,12.176,12.188,12.176,12.188,12.188,12.188,12.188,12.176
2019-04-05 19:18:36 2019-04-05 19:18:39 12.504,12.527,12.516,12.539,12.516,12.504,12.527,12.504,12.527,12.516,12.539,12.516,12.516,12.527,12.516,12.527,12.504,12.539,12.516,12.516,12.527,12.516,12.527,12.504,12.527,12.516,12.516,12.516,12.527,12.516,12.516,12.34,9.492,9.715,9.879,10.078,10.184,10.23,10.254,10.23,10.324,10.605,10.852,10.957,10.945,10.934,10.828,10.629,10.453,10.723,10.887,11.016,11.039,10.945,11.063,11.133,11.191,11.227,11.285,12.188,12.211,12.211,12.211,12.223,12.234,12.234,12.258,12.258,12.258,12.27,12.27,12.281,12.281,12.281,12.27,12.281,12.293,12.293,12.281,12.305,12.293,12.281,12.293,12.305,12.293,12.305,12.305,12.305,12.293,12.316,12.305,12.316,12.316,12.305,12.316,12.305,12.305,12.316,12.328,12.328,12.34,12.34,12.328,12.34,12.305,12.328,12.328,12.328,12.34,12.305,12.352,12.34,12.328,12.352,12.328,12.34,12.305,12.328,12.316,12.305,12.316,12.328,12.352,12.34,12.375,12.328,12.352,12.34,12.352,12.363,12.363,12.375,12.352,12.375,12.352,12.352,12.352,12.363,12.363,12.352,12.387,12.363,12.363,12.352,12.363,12.363,12.34,12.375,12.352,12.363,12.352,12.363,12.363,12.352,12.363,12.34,12.375,12.352,12.352,12.34,12.352,12.352,12.328,12.363,12.328,12.352,12.34,12.352,12.34,12.328,12.363,12.328,12.352,12.328,12.352,12.352,12.328,12.352,12.34,12.363,12.34,12.352,12.34,12.34,12.352,12.316,12.352,12.352,12.352,12.34,12.34,12.363,12.34
2019-04-05 19:20:15 2019-04-05 19:20:18 12.363,12.375,12.375,12.363,12.375,12.387,12.352,12.375,12.363,12.375,12.363,12.375,12.375,12.352,12.387,12.363,12.363,12.363,12.375,12.375,12.363,12.387,12.363,12.375,12.363,12.375,12.375,12.363,12.387,12.352,12.211,12.152,9.34,9.668,9.902,10.02,10.102,10.16,10.184,10.16,10.02,9.961,10.254,10.559,10.723,10.852,10.828,10.723,10.523,10.277,10.523,10.734,10.84,10.934,10.816,10.934,10.992,11.027,11.086,11.133,12.035,12.047,12.059,12.07,12.059,12.105,12.094,12.117,12.094,12.117,12.105,12.117,12.129,12.129,12.129,12.117,12.141,12.105,12.141,12.141,12.082,12.152,12.129,12.141,12.129,12.152,12.129,12.152,12.152,12.141,12.164,12.129,12.164,12.141,12.152,12.152,12.141,12.164,12.152,12.188,12.152,12.188,12.176,12.164,12.164,12.152,12.176,12.152,12.176,12.152,12.164,12.164,12.164,12.176,12.152,12.176,12.129,12.141,12.152,12.141,12.164,12.152,12.164,12.152,12.188,12.199,12.199,12.199,12.176,12.211,12.188,12.199,12.211,12.199,12.199,12.211,12.211,12.176,12.211,12.199,12.199,12.188,12.188,12.188,12.188,12.211,12.188,12.199,12.188,12.188,12.211,12.199,12.199,12.188,12.211,12.211,12.211,12.211,12.199,12.199,12.188,12.211,12.211,12.199,12.199,12.199,12.199,12.188,12.211,12.199,12.188,12.199,12.188,12.199,12.211,12.199,12.199,12.211,12.211,12.188,12.199,12.211,12.199,12.199,12.199,12.188,12.199,12.199,12.199,12.176,12.199,12.211,12.199
2019-04-05 19:20:47 2019-04-05 19:20:50 12.328,12.34,12.34,12.328,12.34,12.34,12.328,12.328,12.328,12.328,12.328,12.34,12.34,12.328,12.352,12.34,12.34,12.328,12.34,12.352,12.34,12.352,12.34,12.34,12.34,12.352,12.34,12.328,12.34,12.34,12.246,12.129,9.035,9.234,9.738,9.914,10.008,10.113,10.148,10.125,10.008,10.031,10.371,10.605,10.781,10.723,10.734,10.641,10.383,10.289,10.547,10.723,10.828,10.781,10.781,10.887,10.969,10.98,11.074,11.918,12,12.023,12.035,12.047,12.047,12.07,12.07,12.082,12.07,12.082,12.094,12.082,12.117,12.094,12.105,12.094,12.094,12.082,12.082,12.105,12.07,12.082,12.07,12.082,12.059,12.082,12.094,12.059,12.105,12.082,12.094,12.094,12.094,12.105,12.105,12.117,12.094,12.141,12.117,12.129,12.141,12.129,12.117,12.105,12.141,12.094,12.129,12.129,12.105,12.129,12.094,12.129,12.105,12.129,12.105,12.105,12.105,12.117,12.141,12.094,12.141,12.117,12.105,12.141,12.141,12.152,12.141,12.152,12.129,12.176,12.176,12.141,12.188,12.141,12.152,12.152,12.176,12.152,12.164,12.164,12.129,12.152,12.129,12.129,12.129,12.141,12.129,12.117,12.164,12.129,12.152,12.141,12.152,12.129,12.141,12.141,12.117,12.152,12.129,12.129,12.141,12.141,12.117,12.117,12.141,12.105,12.141,12.129,12.141,12.152,12.129,12.141,12.141,12.152,12.129,12.129,12.152,12.152,12.141,12.141,12.152,12.129,12.141,12.129,12.141,12.117,12.129,12.152,12.117,12.152,12.129,12.141,12.141,12.152,12.152,12.152,12.176,12.176,12.188,12.199,12.223,12.199,12.211,12.246,12.211,12.258,12.234,12.258,12.27,12.281,12.305,12.293,12.316,12.293,12.316,12.328,12.328,12.352,12.363
2019-04-05 19:24:34 2019-04-05 19:24:37 12.598,12.609,12.609,12.598,12.586,12.609,12.598,12.598,12.598,12.598,12.609,12.598,12.598,12.609,12.598,12.598,12.598,12.598,12.598,12.598,12.609,12.609,12.609,12.586,12.609,12.598,12.598,12.609,12.598,12.598,12.445,12.41,9.234,9.973,10.16,10.242,10.313,10.383,10.371,10.289,10.359,10.688,10.922,11.063,11.027,11.004,10.91,10.688,10.605,10.875,11.051,11.145,11.074,11.109,11.203,11.25,11.32,11.391,12.258,12.305,12.305,12.328,12.328,12.328,12.34,12.352,12.363,12.34,12.375,12.363,12.375,12.375,12.387,12.387,12.387,12.375,12.375,12.387,12.398,12.387,12.398,12.387,12.422,12.387,12.41,12.398,12.41,12.41,12.398,12.41,12.398,12.422,12.398,12.41,12.398,12.41,12.422,12.41,12.434,12.41,12.434,12.41,12.434,12.422,12.422,12.434,12.398,12.445,12.41,12.434,12.422,12.422,12.457,12.41,12.445,12.422,12.445,12.434,12.41,12.445,12.422,12.457,12.457,12.48,12.457,12.434,12.445,12.41,12.457,12.434,12.469,12.457,12.457,12.445,12.445,12.434,12.398,12.445,12.41,12.445,12.445,12.434,12.434,12.434,12.445,12.41,12.445,12.434,12.422,12.445,12.422,12.445,12.434,12.469,12.445,12.445,12.434,12.434,12.445,12.434,12.445,12.434,12.457,12.445,12.445,12.457,12.422,12.457,12.422,12.457,12.434,12.445,12.457,12.445,12.457,12.422,12.457,12.445,12.457,12.434,12.445,12.469,12.445,12.445,12.445,12.457,12.445,12.422,12.445,12.445,12.469,12.445,12.48,12.48,12.48,12.492,12.516,12.527,12.516,12.551,12.551,12.563,12.574,12.586,12.574,12.598,12.621,12.609,12.621,12.633,12.633,12.656,12.668,12.668,12.668,12.68,12.668,12.68
2019-04-05 19:28:06 2019-04-05 19:28:09 12.539,12.563,12.551,12.539,12.551,12.539,12.563,12.539,12.551,12.551,12.551,12.551,12.539,12.563,12.539,12.563,12.539,12.551,12.551,12.539,12.563,12.551,12.563,12.539,12.551,12.551,12.539,12.551,12.539,12.563,12.539,12.363,8.941,9.34,9.961,10.148,10.242,10.336,10.523,10.77,10.91,10.945,10.957,10.934,10.828,10.594,10.441,10.734,10.922,11.063,11.133,11.051,10.852,10.746,10.945,11.063,11.156,10.992,11.098,11.168,11.203,11.309,12.199,12.258,12.234,12.27,12.281,12.293,12.293,12.293,12.293,12.305,12.316,12.328,12.316,12.316,12.316,12.34,12.328,12.328,12.34,12.328,12.328,12.34,12.34,12.328,12.328,12.34,12.34,12.34,12.34,12.34,12.352,12.363,12.352,12.352,12.352,12.352,12.352,12.34,12.352,12.363,12.363,12.363,12.363,12.387,12.375,12.363,12.375,12.387,12.363,12.375,12.375,12.387,12.363,12.398,12.375,12.387,12.352,12.375,12.375,12.363,12.387,12.375,12.387,12.375,12.398,12.422,12.41,12.41,12.387,12.422,12.422,12.422,12.422,12.422,12.434,12.41,12.434,12.398,12.41,12.41,12.398,12.398,12.363,12.398,12.387,12.398,12.387,12.387,12.387,12.387,12.398,12.387,12.41,12.387,12.398,12.398,12.387,12.375,12.375,12.41,12.387,12.375,12.387,12.398,12.41,12.363,12.398,12.387,12.41,12.375,12.387,12.41,12.387,12.387,12.375,12.41,12.375,12.398,12.387,12.375,12.41,12.387,12.398,12.375,12.41,12.398,12.387,12.422,12.398,12.434,12.434,12.469,12.48,12.469,12.48,12.492,12.492,12.504,12.516,12.527,12.551,12.551,12.551,12.574,12.574,12.598,12.598,12.609,12.609,12.609,12.633,12.621,12.656,12.633,12.68,12.633,12.691,12.668,12.68,12.703,12.691,12.703,12.691,12.727,12.715,12.715,12.75", header=TRUE, stringsAsFactors=FALSE)
data1$start <- as.POSIXct(data1$start)
data1$end <- as.POSIXct(data1$end)
data2<-data1%>%group_by(start time,end
time)%>%mutate(time=seq(from=as.POSIXct(starttime, format="%Y-%m-%d
%H:%M:%OS",tz="UTC"),
to=as.POSIXct(endtime, format="%Y-%m-%d %H:%M:%OS", tz="UTC"), by=0.0156))
time value
2019-04-05 19:14:44 12.3
2019-04-05 19:14:455625 11.9
2019-04-05 19:14.47125 12.6
. .
. .
. .
. .
. .
. .