Re: [R] size and coding error in plot ?

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Thu, 17 Jul 2008 21:59:26 -0500

on 07/17/2008 08:44 PM shetumi_at_aim.com wrote:
> Hello R users:
>
> I was trying to draw a boxplot?using 2 variables (rain and wind).
> Both of them has length 25056. So dummy is a matrix with dimension 2
> x 25056. First I tried to draw a full boxplot using the following
> code?and gave an error
>

>> boxplot(dummy$Rain~dummy$Wind)

>
> Error: cannot allocate vector of size 2.8 Gb In addition: Warning
> messages: 1: In rep.int(boxwex, n) : ? Reached total allocation of
> 1535Mb: see help(memory.size) 2: In rep.int(boxwex, n) : ? Reached
> total allocation of 1535Mb: see help(memory.size) 3: In
> rep.int(boxwex, n) : ? Reached total allocation of 1535Mb: see
> help(memory.size) 4: In rep.int(boxwex, n) : ? Reached total
> allocation of 1535Mb: see help(memory.size)
>
> and?thereafter I tried to draw boxplots at regular intervals (that
> means ) and that didnt work either
>
>> boxplot(dummy$Rain~cut(dummy$Wind,(1:25)*1000), data=dummy)

>
> Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs =
> pars$yaxs) : ? need finite 'ylim' values In addition: Warning
> messages: 1: In is.na(x) : is.na() applied to non-(list or vector) of
> type 'NULL' 2: In is.na(x) : is.na() applied to non-(list or vector)
> of type 'NULL' 3: In is.na(x) : is.na() applied to non-(list or
> vector) of type 'NULL' 4: In min(x) : no non-missing arguments to
> min; returning Inf 5: In max(x) : no non-missing arguments to max;
> returning -Inf
>
> Also I used
>
> ?boxplot(dummy$Rain~cut(dummy$Wind,
> breaks=seq(from=1,to=25000,by=1000)), data=dummy)
>
> and that showing only sigle boxplot at far left corner.
>
>
> What would be the right ting to do ?

If you are simply looking to create 2 side by side boxplots, one for each variable, Rain and Wind, and your data is in a data frame called 'dummy', then you want to use:

   boxplot(dummy)

The use of '$' in your code above indicates that 'dummy' is a data frame, not a matrix.

Right now, you are trying to draw a potentially large number of boxplots, one for each unique value of Wind, which is why the process is running out of memory.

If that is not what you are trying to do, then you'll need to provide more information.

HTH, Marc Schwartz



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jul 2008 - 03:04:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jul 2008 - 03:32:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive