我正在尝试绘制WaterLevel
与Datetime
(我格式化了datetime的格式),但是出现类似
seq.int(0,to0-from,by)中的错误:“ to”必须为有限数字
library(ggplot2)
library(scales)
library(shiny)
library(stringi)
file = "http://dd.weather.gc.ca/hydrometric/csv/SK/hourly/SK_hourly_hydrometric.csv"
skdat <- read.csv(file, head=T, sep=",", dec=".", stringsAsFactors = F)
colnames(skdat) <- c("ID", "Date", "WaterLevel", "Grade1", "Symbol1",
"QAQC-1", "DischargeDebit", "Grade2", "Symbol2",
"QAQC-2")
subds <- subset(skdat, ID=='05EF001')
subds$datetime <- as.POSIXct(subds$Date, format = "%Y-%m-%dT%H%m%S-06:00")
p2 <- ggplot(subds, aes(x = datetime, y = WaterLevel)) + geom_line()
p2
我尝试了不同的格式,我知道数据很好,因为它也可以在简单的图中绘制。