Re: [R] error using boxplot.stats (but boxplot works¿?)

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sun, 06 May 2007 07:27:32 -0400

On 06/05/2007 4:34 AM, Hugo M.Fernandez Bellon wrote:
> Hi
>
> The answer to this may be obvious, but it's got me floored.
>
> I'm unable to get boxplot.stats to work for me!
>
> My session looks something like this:
>
> > ia=read.table('/tmp/prueba.csv', header=TRUE, sep=",")
> > attach(ia)
>
> > boxplot.stats(X8weeks~Orden)
>
> Error in sort (na.last, decreasing, ...) :
> argument 1 is not a vector

See ?boxplot.stats. It can't handle a formula argument, it wants a numeric vector.
>
> In addition: Warning messages:
> 1: is.na() applied to non-(list or vector) in: is.na(x)
> 2: is.na() applied to non-(list or vector) in: is.na(x)
> 3: is.na() applied to non-(list or vector) in: FUN(X[[1]], ...)
>
> [the error message in R 2.3.1 is slightly different: it says it is not
> atomic and shows only the 1st two warning messages]
>
> However, boxplot(X8weeks~Orden) prints the boxplot properly (no error messages, data accurately represented).

You can use boxplot(X8weeks ~ Orden, plot=FALSE).

Duncan Murdoch

>

>> is.numeric(X8weeks)=TRUE
>> is.factor(Orden)=TRUE

> "X8weeks" has no NA's
>
>
> So, the question is: how can I access the data used to generate the boxplot (and why does boxplot.stats fail)?
>
>
> Thanks!
>
> Hugo Fernández
>
> -------------
> > sessionInfo()
> R version 2.4.1 (2006-12-18)
> i486-pc-linux-gnu
>
> locale:
> LC_CTYPE=es_ES.UTF-8_at_euro;LC_NUMERIC=C;LC_TIME=es_ES.UTF-8_at_euro;
> LC_COLLATE=es_ES.UTF-8_at_euro;LC_MONETARY=es_ES.UTF-8_at_euro;
> LC_MESSAGES=es_ES.UTF-8_at_euro;LC_PAPER=es_ES.UTF-8_at_euro;
> LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;
> LC_MEASUREMENT=es_ES.UTF-8_at_euro;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
> [7] "base"
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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.


R-help_at_stat.math.ethz.ch 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 Sun 06 May 2007 - 11:31: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 Sun 06 May 2007 - 22:31:19 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.