[R] boxplot with grouped variables

Bert Gunter gunter.berton at gene.com
Sat May 11 19:00:38 CEST 2013

It will not work because the presence of the first row means that all
the variables are read in as factors, not numeric. You must convert
numeric variables to numeric **after** eliminating the first row, or
read the data in using read.table(..., head=TRUE). See ?read.table for

**After** the above changes, perhaps

with(Daten, boxplot(Gewicht ~ interaction(Dosis,Geshlecht, drop=TRUE)) )

will work if you read in column names properly. Otherwise, V2
~interaction(V1,V3, drop=TRUE) if you do the conversions to numeric.

Please read *An Introduction to R" or other online R tutorial before
posting further here. You need to understand basic R data handling
before you proceed. At present, you do not.

-- Bert

On Sat, May 11, 2013 at 8:40 AM, maggy yan <kiotoqq at gmail.com> wrote:
> my dataset looked like this in the beginning:
>       V1      V2         V3
> 1  Dosis Gewicht Geschlecht
> 2      0    6.62          m
> 3      0    6.65          m
> 4      0    5.78          m
> 5      0    5.63          m
> I need box plots for V2 with all combination of V1 and V3, so I deleted the
> first row, and tried this:
> boxplot(Daten$V2[Daten$V3=="m"])
> but it does not work and I have no clue what I did wrong.
> I'm thankful for any help!
>         [[alternative HTML version deleted]]
> ______________________________________________
> 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.


Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374

More information about the R-help mailing list