开发者

R/ggplot error: too large for hashing

开发者 https://www.devze.com 2023-02-16 23:39 出处:网络
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:

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开发者_Python百科 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""


Try setting a timezone explicitly in the call to as.POSIXct(), as in https://gist.github.com/925852

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号