error time issue

9 views
Skip to first unread message

James McCreight

unread,
Mar 12, 2013, 12:09:01 PM3/12/13
to ggplot2-dev

recently, i've been using some reasonably large data sets (nrow = 1E5-1E6, ncol=7). 

e.g. :
size=100000
dum=data.frame( a=rnorm(size), b=runif(size), c=rnorm(size) )

I occasionally, i'll insert a new line into my ggplot command and forget the +. For example, say i had a much longer set of commands but then i wanted to put  a vertical line in on the bottom layer:

ggplot(dum, aes(x=b,y=a)) + geom_vline(xint=0)
## other previous commands down here are ignored

I get the following error, 
Error in as.environment(where) : 'where' is missing

and I can understand this but the real problem is that (it seems) when the data sets get large, it takes increasingly long for this error to be produced. (The above code should demonstrate this.) Sometimes I'll wait minutes and I have killed my R session in a few cases because I thought there was no hope it would ever return.

If there is a way, i think it would be desirable to prevent this behavior. That's my entire suggestion. I have no idea how to do it.

I did notice that if I wrap the statement in print(), it seems to return MUCH faster. So maybe there is hope. 

Lastly, thanks for all ya'll's work! 

James
--
-

Hadley Wickham

unread,
Mar 13, 2013, 12:15:56 PM3/13/13
to James McCreight, ggplot2-dev
Hi James,

Yeah, this is annoying, but I don't know how to fix it. It's
something to do with how the traceback is generated - if you run
traceback() you'll notice it contains the complete contents of your
data set. There's probably some way to fix this, but I've never
managed to figure out why it occurs or how to fix it.

Hadley
> --
> You received this message because you are subscribed to the Google Groups
> "ggplot2-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Chief Scientist, RStudio
http://had.co.nz/
Reply all
Reply to author
Forward
0 new messages