简体   繁体   中英

R/ggplot error: too large for hashing

I'm plotting a time series graph using ggplot, however whenever the size of the data frame is greater than around 600, ggplot throws the following error:

Error in anyDuplicated.default(breaks) : length 1136073601 is too large for hashing

In fact, it just gave me the same error when I try to plot 400 items.

The data is melted like so, except there are four variables- speed, dir, temp and pressure:

                   time variable       value
1   2006-07-01 00:00:00    speed    4.180111
2   2006-07-02 00:00:00    speed    5.527226
3   2006-07-09 00:00:00    speed    6.650821
4   2006-07-16 00:00:00    speed    4.380063
5   2006-07-23 00:00:00    speed    5.641709
6   2006-07-30 00:00:00    speed    7.636913
7   2006-08-06 00:00:00    speed    7.128334
8   2006-08-13 00:00:00    speed    4.719046
...
201 2006-07-01 00:00:00     temp   17.140069
202 2006-07-02 00:00:00     temp   17.517480
203 2006-07-09 00:00:00     temp   14.211002
204 2006-07-16 00:00:00     temp   20.121617
205 2006-07-23 00:00:00     temp   17.933492
206 2006-07-30 00:00:00     temp   15.244583

My code to plot these is based on what I found here: http://had.co.nz/ggplot2/scale_date.html

qplot(time,value,data=test3,geom="line",group=variable) + 
+ facet_grid(variable ~ ., scale = "free_y")

Any pointers and I'd be very grateful!!

To massage the date from character to date i'm using:

test$time <- strptime(test$time, format="%Y-%m-%d %H:%M:%S")
test$time <- as.POSIXct(test$time, format="%H:%M:%S")
test3 = melt(test,id="time")

class(test$time) returns "[1] "POSIXt" "POSIXct""

尝试在对as.POSIXct()的调用中显式设置时区,如https://gist.github.com/925852

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM