Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/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 包含数据和时间的子集xts对象_R_Time Series_Subset_Xts - Fatal编程技术网

R 包含数据和时间的子集xts对象

R 包含数据和时间的子集xts对象,r,time-series,subset,xts,R,Time Series,Subset,Xts,我有一个xts对象,它表示在两周的时间段内使用15分钟采样测量的变量 数据示例如下所示: > class(wideRawXTS) [1] "xts" "zoo" > head(wideRawXTS[,2],10) DO0182U09B3 2017-01-20 16:30:00 -103.37 2017-01-20 16:45:00 -102.75 2017-01-20 17:00:00 -103.30 2017-01-

我有一个xts对象,它表示在两周的时间段内使用15分钟采样测量的变量

数据示例如下所示:

> class(wideRawXTS)
[1] "xts" "zoo"

> head(wideRawXTS[,2],10)
                    DO0182U09B3
2017-01-20 16:30:00     -103.37
2017-01-20 16:45:00     -102.75
2017-01-20 17:00:00     -103.30
2017-01-20 17:15:00      -95.92
2017-01-20 17:30:00     -103.04
2017-01-20 17:45:00     -103.67
2017-01-20 18:00:00     -103.26
2017-01-20 18:15:00     -103.86
2017-01-20 18:30:00     -103.96
2017-01-20 18:45:00     -103.33

> str(wideRawXTS)
An ‘xts’ object on 2017-01-20 16:30:00/2017-02-03 16:00:00 containing:
  Data: num [1:1343, 1:12] -102 -101 -101 -101 -101 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:12] "DO0182U09A3" "DO0182U09B3" "DO0182U09C3" "DO0182U21A1" ...
  Indexed by objects of class: [POSIXlt,POSIXt] TZ: 
  xts Attributes:  
 NULL
我希望提取单个变量的每天数据,即24小时数据-2017-01-20 16:30:00->2017-01-21 16:30:00,以便计算该单个变量的日内相关性

我已经签出,但它没有处理包含日期和时间组件的数据


如何将此XTS对象子集为14天的数据块(96个样本)?

如果您正在寻找与其他序列的日内相关性,可以使用
XTS::apply.daily

库(xts)
泰晤士报2000-01-03 23:45:00 0.011104314
#> 2000-01-04 23:45:00 -0.085361525
#> 2000-01-05 23:45:00 -0.047193367
#> 2000-01-06 23:45:00  0.149419147
#> 2000-01-07 23:45:00  0.068223067
#> 2000-01-08 23:45:00  0.002006084
#> 2000-01-09 23:45:00  0.023573252
#>2000-01-10 00:00:00北美

资料来源:来源于约书亚·乌尔里奇的答案。

看看朱巴斯的答案