给出以下命令并给出与时间有关的错误。 我尝试阅读.CSV。列作为日期和时间,问题仍然相同。 我不确定日期或格式是什么问题。 数据的日期和时间格式为dd / mm / yyyy hr:min 在使用演习样本命令时效果很好。即
summaryPlot(package_exercisesample)
rm(list = ls())
library(lubridate)
library(readr)
library(openair)
package_exercisesample<- openair::mydata
dat<- read_csv("data.csv")
summaryPlot(dat)
这是我遇到的错误
使用列规范进行了解析:
cols(
Date = col_character(),
ws = col_double(),
wd = col_double(),
Co = col_double(),
No = col_double(),
O3 = col_double(),
Pm2.5 = col_double(),
Pm10 = col_double(),
So2 = col_double()
)
summaryPlot(dat)
as.POSIXct.default(x)中的错误:
. do not know how to convert 'x' to class “POSIXct”
In addition: Warning messages:
1: Unknown or uninitialised column: 'date'.
2: Unknown or uninitialised column: 'date'.
3: Unknown or uninitialised column: 'date'.
* dput(head(mydata,12))
structure(list(date = structure(c(883612800,883616400,883620000, 883623600、883627200、883630800、883634400、883638000、883641600, 883645200、883648800、883652400),类= c(“ POSIXct”,“ POSIXt”), tzone =“ GMT”),ws = c(0.6,2.16,2.76,2.16,2.4,3,3,3, 3.36、3.96、6.36、8.16),wd = c(280L,230L,190L,170L,180L,190L,140L,170L,170L,170L,180L,190L),nox = c(285L,NA,NA,493L, 468L,264L,171L,195L,137L,113L,100L,109L),no2 = c(39L,NA,NA, 52L,78L,42L,38L,51L,42L,39L,34L,38L),o3 = c(1L,NA,3L,3L, 2L,0L,0L,0L,1L,2L,7L,8L),pm10 = c(29L,37L,34L,35L,34L, 16L,11L,12L,12L,12L,10L,11L),因此so2 = c(4.7225,NA,6.83,7.6625, 8.07、5.505、4.23、3.875、3.3475、2.9225、3.06, 1.7475),co = c(3.3725,NA,9.6025,10.2175,8.9125,3.0525, 2.265,1.995,1.455,1.205,0.9825,1.43),pm25 = c(NA_integer_,NA_integer_,NA_integer_,NA_integer_,NA_integer_,NA_integer_, NA_integer_,NA_integer_,NA_integer_,NA_integer_,NA_integer_, NA_integer _)),row.names = c(NA,-12L),class = c(“ tbl_df”,“ tbl”, “ data.frame”))*
对不起,通过将输入日期数据的列名更改为“ date”而不是“ Date”解决了问题