Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
r-计算每秒的事务数_R - Fatal编程技术网

r-计算每秒的事务数

r-计算每秒的事务数,r,R,如果我有一个带有日期的数据集: head(ds$TransStartTmdte) [1] "2011-05-09 08:50:12" "2011-05-09 09:03:46" "2011-05-09 09:06:49" "2011-05-09 09:13:05" "2011-05-09 14:21:58" "2011-05-09 14:23:00" 当每一行代表一个“事务”时,我如何计算每秒的事务 日期格式为POSIXt dput(head(ds$TransStartTmdte)) s

如果我有一个带有日期的数据集:

head(ds$TransStartTmdte) 

[1] "2011-05-09 08:50:12" "2011-05-09 09:03:46" "2011-05-09 09:06:49" "2011-05-09 09:13:05" "2011-05-09 14:21:58" "2011-05-09 14:23:00"
当每一行代表一个“事务”时,我如何计算每秒的事务

日期格式为POSIXt

dput(head(ds$TransStartTmdte))

structure(list(sec = c(0.007, 0.013, 0.018, 0.012, 0.043, 0.039
), min = c(34L, 34L, 34L, 34L, 34L, 34L), hour = c(14L, 14L, 
14L, 14L, 14L, 14L), mday = c(9L, 9L, 9L, 9L, 9L, 9L), mon = c(4L, 
4L, 4L, 4L, 4L, 4L), year = c(111L, 111L, 111L, 111L, 111L, 111L
), wday = c(1L, 1L, 1L, 1L, 1L, 1L), yday = c(128L, 128L, 128L, 
128L, 128L, 128L), isdst = c(1L, 1L, 1L, 1L, 1L, 1L)), .Names = c("sec", 
"min", "hour", "mday", "mon", "year", "wday", "yday", "isdst"
), class = c("POSIXlt", "POSIXt"))
这对你有用吗

table(cut(transactionTime, "secs"))
例如:

plot(table(cut(ds$TransStartTmdte, "secs")), main=mydataset ,xlab="date ", ylab="Trans",pch=20)

你的问题有点模棱两可。你能澄清一下你的意思吗?平均每秒事务数?每秒钟的事务数?对于每个条目,过去1000微秒内的事务数?我正在tpc.org上寻找“每秒事务数”的定义。我想绘制每秒事务数的“运行平均值”。有趣的是,您给出的dput与您在帖子中显示的标题(ds$TransStartTmdte)并不一致。