Skip to content

boxplot(list(m[,1],...,m[,c]))

7 messages · Richard Dybowski, Martin Maechler, Gavin Simpson +4 more

#
Given a matrix m, I would like to obtain a boxplot of the columns of m; in 
other words, boxplot(list(m[,1],...,m[,ncol(m)])). At the moment, I am using

colpart <- function(m){
         L <- list(rep(0,ncol(m)))
         for(i in 1:ncol(m)){
                 L[[i]] <- m[,i] }
         return(L)}
boxplot(colpart(m))

for this purpose. Surely there must be a more eloquent way!

Richard

-------------------------------
Richard Dybowski, 143 Village Way, Pinner, Middlesex  HA5 5AA, UK
Tel (mobile): 079 76 25 00 92

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Richard> Given a matrix m, I would like to obtain a boxplot of the
    Richard> columns of m; in other words,
    Richard> boxplot(list(m[,1],...,m[,ncol(m)])). At the moment, I am
    Richard> using

	     <...>

    Richard> for this purpose. Surely there must be a more eloquent way!

Indeed!
It's even in the `Examples' section of  help(boxplot) :

Use
	boxplot(data.frame(m))

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,

Is it possible to do something similar to

	boxplot(data.frame(m))

but have different scales for each of the boxplots?

The reason I ask is that I have a series of lake chemistry measurements
and I want to plot a diagram with boxplots for a number of variables. 
The variables are measured in different units and some variables are
orders of magnitude bigger than others.  Any help with this would be
appreciated.

Using R 1.3.0 on NT4

Cheers

Gav
#
Gavin Simpson wrote:

            
Then you should better create a new plot for each of your variables with
different units, e.g.:

  x <- rnorm(10)
  y <- rnorm(10, 100, 10)
  z <- rnorm(10, 1000, 3)
  BL <- list(x, y, z) 	# or data.frame
  par(mfrow = c(1, 3))  # 1 row and 3 columns of plots
  lapply(BL, boxplot)

Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 5 Jul 2001, Gavin Simpson wrote:

            
I think for this that you are back to:
(with a version of the same thing to give labels). If the y scales
are different for the matrix columns, they will need the y-axis, though it
would "save ink" to just have the left y axes plotted, something like:
+ axis(2)}

Roger
#
In the previous release of r, theire  was a index of all functions in R.
It was was i understand as reference. It was simple to search in this html
page by function name or by keywords.
Why, by god, this page is removed in the Veriosn 1.3 of R???



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 5 Jul 2001, Eryk Wolski wrote:

            
Take a look at R_HOME/doc/html/function.html ....  The browser-based search
engine was not on that page, but help.start() will lead you to where it has
always been.