as.POSIXlt vs as.date和strptime

时间:2018-02-10 14:38:04

标签: r plot

基本上,我有一个家庭每分钟耗电量的日期,我有9列数据,我的数据是:

https://archive.ics.uci.edu/ml/datasets/Individual+household+electric+power+consumption

所以我尝试了两件事并得到了两个不同的输出,我似乎无法弄清楚为什么会这样:

首先输入:

performed

enter image description here

第二个输入:

hpc$Datetime<-as.POSIXlt(hpc$Datetime, format = "%d/%m/%Y %H:%M:%S")

with(hpc,plot(Datetime,Global.active.power, ylab = "Global.active.power(Killowatts)", 
     xlab = "",type = "l"))

enter image description here

为什么第二张图片中出现了一条线 如果有人可以帮助我,那将是一件好事! 提前谢谢

0 个答案:

没有答案