Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/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
调用arrange后合并两个数据帧时出错_R_Merge_Dataframe - Fatal编程技术网

调用arrange后合并两个数据帧时出错

调用arrange后合并两个数据帧时出错,r,merge,dataframe,R,Merge,Dataframe,我有两个名为“a1”和“a2”的数据帧,是我通过read.csv引入的,每个数据帧中都有一个名为“time”的列,我使用strtime将类设置为POSIXlt 在尝试合并数据帧之前,我调用了arrange(a1,time)和arrange(a2,time)以获得从最旧到最新的顺序。然后我尝试调用ahu1,不管怎样,这两个数据对象的拖数完全相同,日期时间也相同。因此,使用cbind()将是一个简单的步骤。时间列不匹配 cbind(a1, a2[-1]) tim

我有两个名为“a1”和“a2”的数据帧,是我通过read.csv引入的,每个数据帧中都有一个名为“time”的列,我使用strtime将类设置为POSIXlt


在尝试合并数据帧之前,我调用了
arrange(a1,time)
arrange(a2,time)
以获得从最旧到最新的顺序。然后我尝试调用
ahu1,不管怎样,这两个数据对象的拖数完全相同,日期时间也相同。因此,使用cbind()将是一个简单的步骤。
时间
列不匹配

 cbind(a1, a2[-1])

                 time status.sf status.rf cfm.oa cfm.ra temp.ra temp.ma temp.sa
1 2014-02-24 10:00:00      TRUE      TRUE 1397.6 2364.8    68.6    65.6    51.1
2 2014-02-24 10:15:00      TRUE      TRUE  343.0 3067.4    67.6    65.8    66.4
3 2014-02-24 10:30:00      TRUE      TRUE 1265.0 2073.9    69.1    66.8    68.6
4 2014-02-24 10:45:00      TRUE      TRUE 1500.0 2727.4    69.7    67.9    51.2
5 2014-02-24 11:00:00      TRUE      TRUE  744.5 2561.2    67.9    66.5    67.3
6 2014-02-24 11:15:00      TRUE      TRUE 1261.6 2032.4    69.0    68.2    68.0
  ductstatic fault.hum fltpress fault.smoke occpt max.dmprpos mode.ecm
1       0.25     FALSE     0.15       FALSE  TRUE          77     TRUE
2       0.25     FALSE     0.12       FALSE  TRUE          63     TRUE
3       0.25     FALSE     0.12       FALSE  TRUE          71     TRUE
4       0.47     FALSE     0.22       FALSE  TRUE          93     TRUE
5       0.27     FALSE     0.13       FALSE  TRUE          63     TRUE
6       0.25     FALSE     0.13       FALSE  TRUE          71     TRUE
  mode.dehum spt.sa spt.ductstatic mode.co2 mode.hum max.runreqt max.vavco2
1       TRUE     53           0.27    FALSE    FALSE           0        427
2      FALSE     66           0.25    FALSE    FALSE           0        429
3      FALSE     66           0.25    FALSE    FALSE           0        427
4      FALSE     66           0.57    FALSE    FALSE           0        414
5      FALSE     66           0.25    FALSE    FALSE           0        417
6      FALSE     66           0.25    FALSE    FALSE           0        406
  max.vavrhv cfm.vavtot spt.cfm.ra
1         59       2711       2461
2       56.4     2383.6       2133
3       54.9     2395.8     2144.3
4       56.1     3702.9     3433.7
5       53.3     2449.8     2198.8
6       50.1     2388.4     2139.3

您能否在
dput(head(a1))
dput(head(a2))
的结果中进行编辑,这将导致您的问题?(另外,请不要担心我删掉了你文章的第一句话;Stack Exchange的政策就是避免这样的句子)。最好将代码显示在多行中(您可以用四个字符缩进,就像我在处理错误消息时所做的那样),而不是将其与文本混合在一起。排列从何而来?似乎不在基础中。它来自plyr(应该在上面的问题中添加
library(plyr)
)。但是,问题没有明确说明他是否做了
a1
?整理
:在指定的包和库中没有“整理”的文档:您可以尝试“整理”
?plyr::整理
将为您提供帮助文件
structure(list(time = structure(list(sec = c(0, 0, 0, 0, 0, 0), min = c(0L, 15L, 30L, 45L, 0L, 15L), hour = c(10L, 10L, 10L, 10L, 11L, 11L), mday = c(24L, 24L, 24L, 24L, 24L, 24L), mon = c(1L, 
1L, 1L, 1L, 1L, 1L), year = c(114L, 114L, 114L, 114L, 114L, 114L), wday = c(1L, 1L, 1L, 1L, 1L, 1L), yday = c(54L, 54L, 54L, 54L, 54L, 54L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L), zone = c("MST", 
"MST", "MST", "MST", "MST", "MST"), gmtoff = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_)), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", "POSIXt")), status.sf = c("TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE"), status.rf = c("TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE"), cfm.oa = c(1397.6, 343, 1265, 1500, 744.5, 1261.6), cfm.ra = c("2364.8", "3067.4", "2073.9", "2727.4", "2561.2", "2032.4"), temp.ra = c(68.6, 67.6, 69.1, 69.7, 67.9, 69), temp.ma = c(65.6, 65.8, 66.8, 67.9, 66.5, 68.2), temp.sa = c(51.1, 66.4, 68.6, 51.2, 67.3, 68), ductstatic = c(0.25, 0.25, 0.25, 0.47, 0.27, 0.25), fault.hum = c("FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE"), fltpress = c(0.15, 0.12, 0.12, 0.22, 0.13, 0.13), fault.smoke = c("FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE")), .Names = c("time", "status.sf", "status.rf", "cfm.oa", "cfm.ra", "temp.ra", "temp.ma", "temp.sa", 
"ductstatic", "fault.hum", "fltpress", "fault.smoke"), row.names = c(NA, 6L), class = "data.frame")



structure(list(time = structure(list(sec = c(0, 0, 0, 0, 0, 0), min = c(0L, 15L, 30L, 45L, 0L, 15L), hour = c(10L, 10L, 10L, 10L, 11L, 11L), mday = c(24L, 24L, 24L, 24L, 24L, 24L), mon = c(1L, 1L, 1L, 1L, 1L, 1L), year = c(114L, 114L, 114L, 114L, 114L, 114L), wday = c(1L, 1L, 1L, 1L, 1L, 1L), yday = c(54L, 54L, 54L, 54L, 54L, 54L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L), zone = c("MST", "MST", "MST", "MST", "MST", "MST"), gmtoff = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_)), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", "POSIXt")), occpt = c("TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE"), max.dmprpos = c(77, 63, 71, 93, 63, 71), mode.ecm = c("TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE"), mode.dehum = c("TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE"), spt.sa = c("53", "66", "66", "66", "66", "66"
), spt.ductstatic = c("0.27", "0.25", "0.25", "0.57", "0.25", "0.25"), mode.co2 = c("FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE"), mode.hum = c("FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE"), max.runreqt = c("0", "0", "0", "0", "0", "0"), max.vavco2 = c("427", "429", "427", "414", "417", "406"), max.vavrhv = c("59", "56.4", "54.9", "56.1", "53.3", "50.1"), cfm.vavtot = c("2711", "2383.6", 
"2395.8", "3702.9", "2449.8", "2388.4"), spt.cfm.ra = c("2461", "2133", "2144.3", "3433.7", "2198.8", "2139.3")), .Names = c("time", "occpt", "max.dmprpos", "mode.ecm", "mode.dehum", "spt.sa", "spt.ductstatic", "mode.co2", "mode.hum", "max.runreqt", "max.vavco2", "max.vavrhv", "cfm.vavtot", "spt.cfm.ra"), row.names = c(NA, 6L), class = "data.frame")
 cbind(a1, a2[-1])

                 time status.sf status.rf cfm.oa cfm.ra temp.ra temp.ma temp.sa
1 2014-02-24 10:00:00      TRUE      TRUE 1397.6 2364.8    68.6    65.6    51.1
2 2014-02-24 10:15:00      TRUE      TRUE  343.0 3067.4    67.6    65.8    66.4
3 2014-02-24 10:30:00      TRUE      TRUE 1265.0 2073.9    69.1    66.8    68.6
4 2014-02-24 10:45:00      TRUE      TRUE 1500.0 2727.4    69.7    67.9    51.2
5 2014-02-24 11:00:00      TRUE      TRUE  744.5 2561.2    67.9    66.5    67.3
6 2014-02-24 11:15:00      TRUE      TRUE 1261.6 2032.4    69.0    68.2    68.0
  ductstatic fault.hum fltpress fault.smoke occpt max.dmprpos mode.ecm
1       0.25     FALSE     0.15       FALSE  TRUE          77     TRUE
2       0.25     FALSE     0.12       FALSE  TRUE          63     TRUE
3       0.25     FALSE     0.12       FALSE  TRUE          71     TRUE
4       0.47     FALSE     0.22       FALSE  TRUE          93     TRUE
5       0.27     FALSE     0.13       FALSE  TRUE          63     TRUE
6       0.25     FALSE     0.13       FALSE  TRUE          71     TRUE
  mode.dehum spt.sa spt.ductstatic mode.co2 mode.hum max.runreqt max.vavco2
1       TRUE     53           0.27    FALSE    FALSE           0        427
2      FALSE     66           0.25    FALSE    FALSE           0        429
3      FALSE     66           0.25    FALSE    FALSE           0        427
4      FALSE     66           0.57    FALSE    FALSE           0        414
5      FALSE     66           0.25    FALSE    FALSE           0        417
6      FALSE     66           0.25    FALSE    FALSE           0        406
  max.vavrhv cfm.vavtot spt.cfm.ra
1         59       2711       2461
2       56.4     2383.6       2133
3       54.9     2395.8     2144.3
4       56.1     3702.9     3433.7
5       53.3     2449.8     2198.8
6       50.1     2388.4     2139.3