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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
boxplot(list(m[,1],...,m[,c]))
7 messages · Richard Dybowski, Martin Maechler, Gavin Simpson +4 more
"Richard" == Richard Dybowski <rdybowski at btinternet.com> writes:
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"Richard" == Richard Dybowski <rdybowski at btinternet.com> writes:
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))
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 Postgraduate Environmental Change Research Centre University College London 26 Bedford Way London WC1H 0AP T: 020 7679 5527 (Graduate Room) 020 7679 5536 (Microscope Room) E: gavin.simpson at ucl.ac.uk W: http://www.geog.ucl.ac.uk/ecrc **************************************************************************** -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Gavin Simpson wrote:
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.
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:
"Richard" == Richard Dybowski <rdybowski at btinternet.com> writes:
Richard> Given a matrix m, I would like to obtain a boxplot of the
Richard> columns of m; in other words,
Use
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.
I think for this that you are back to:
oldpar <- par(mfrow=c(1,ncol(mat))) invisible(apply(mat,2,boxplot)) for (i in 1:ncol(mat)) boxplot(mat[,i], main=colnames(mat)[i]) par(oldpar)
(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:
for (i in 1:ncol(mat)) {boxplot(mat[,i], main=colnames(mat)[i], axes=F)
+ axis(2)} Roger
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no and: Department of Geography and Regional Development, University of Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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:
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???
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.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._