[R] boxplot with grouped variables

S Ellison S.Ellison at LGCGroup.com
Sat May 11 20:20:35 CEST 2013

You can't mix number and character data in a data frame column, so you will probably find that all your variables are factors, not numbers. Try, for example

It looks like you failed to specify 'header=TRUE' in a read.table statement. Reread the data with headers properly treated so that those first items become the variable names.

In additon, Daten$V2[Daten$V3=="m"]) will only give you data for rows in which V3=="m", which will be a single boxplot. (see ?"[" for what that subsetting operation does). To plot all combinations ( if V2 were correctly numeric) you could try
boxplot(V2~V1+V3, data=Daten)

S Ellison
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of maggy yan [kiotoqq at gmail.com]
Sent: 11 May 2013 16:40
To: R-help at r-project.org
Subject: [R]  boxplot with grouped variables

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:
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
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

This email and any attachments are confidential. Any use...{{dropped:8}}

More information about the R-help mailing list