[R] boxplot will remember the factor levels

Petr PIKAL petr.pikal at precheza.cz
Fri Aug 31 08:33:12 CEST 2007


> Try:
> 
> boxplot(mLength ~ puntar[drop=T],data=test)
> 
> 
> -- 
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
> 
> On 30/08/2007, Luis Ridao Cruz <Luisr at frs.fo> wrote:
> >
> > R-help,
> >
> > I'm trying to do a simple box-and-whisker plot to some data.
> > The data are a subset of a large data frame
> > but when running the "boxplot" function on the subset data
> > all the factors are still present in the graph leaving a huge
> > empty space until the actuals factors are shown.
> > This produces a spurious box-and-whisker plot.
> >
> > If the subset data are exported to another R session the problem is
> > gone.
> > Why are the factors still "remembered" by the boxplot?

Actually puntar "remembers" all levels, not boxplot. Look at ?factor and 
"drop" parameter as Henrique pointed.

Regards
Petr

> >
> > Attached is a copy of the data.
> >
> >
> > Thanks in advance
> >
> >
> > ## the line code
> > boxplot(mLength ~ puntar,data=test)
> >
> > > version
> >                _
> > platform       i386-pc-mingw32
> > arch           i386
> > os             mingw32
> > system         i386, mingw32
> > status
> > major          2
> > minor          5.1
> > year           2007
> > month          06
> > day            27
> > svn rev        42083
> > language       R
> > version.string R version 2.5.1 (2007-06-27)
> > >
> >
> >
> > ______________________________________________
> > 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.
> >
> >
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list