[R] Extracting numerical vectors from an array - use of multhist (plotrix)

Ben Bolker bolker at ufl.edu
Mon Mar 20 04:24:53 CET 2006


Ana Florencia Silbering <anafs <at> zedat.fu-berlin.de> writes:

> I am trying to create a histogram containing several data sets (I would
> like to see how the dependent variable is distributed for the different
> groups). This should be possible using the function multhist contained
> in the plotrix package. (I am using R 2.2.1, in windows XP).
> I have an array with 
> 
> > dim(risetime)
> [1]  5  8  4  4 79
> 
> And I would like to plot subsets of this array with multhist. As far as
> I could understand multhist can only use a list of numerical vectors,
> and that is why it can not process something like:
> 
> multhist(list(risetime[,,,1,],risetime[,,,2,],risetime[,,,3,],
> risetime[,,,4,],breaks="FD")
> 
> On the other hand, if I try:
> multhist(risetime[,,,1,],risetime[,,,2,],
> 	breaks="FD",xlab="rise time (sec)",ylab="counts",
> 	xlim=c(0,8))

  I think you need

multhist(list(risetime[,,,1,],risetime[,,,2,]))

or for more clarity

L <- list(risetime[,,,1,],risetime[,,,2,])
multhist(L)

 (try it that way first and then put in all the
extra arguments)

  good luck
   Ben Bolker




More information about the R-help mailing list