我正在尝试将localminute
绘制为x轴,将meter_value
绘制为y轴。数据集有11.9K行,这里是一个片段:
localminute,dataid,meter_value
2016-01-01 05:18:49.497023-06,35,98178
2016-01-01 05:45:43.51577-06,35,98182
2016-01-01 05:57:45.024395-06,35,98184
2016-01-01 06:08:41.532267-06,35,98186
2016-01-01 06:36:50.053034-06,35,98188
2016-01-01 06:56:53.066606-06,35,98192
2016-01-01 08:57:53.65758-06,35,98212
我用过" ggplot"评论但得到错误"使用方法错误("深度"):...
test <- read.csv("test_35.csv") #read data in csv file, to plot data
ggplot(test, aes(x=localminute, y=meter_value)) + geom_point() +
ggtitle("meter value for dataID=35") +
theme(axis.text.x = element_text(angle=90, hjust=1))
Error in UseMethod("depth") :
no applicable method for 'depth' applied to an object of class "NULL"`
答案 0 :(得分:1)
在读取文件时指定变量的格式:
test <- read.csv('test_35.csv', colClasses = c('POSIXct','integer','integer'))