Ana Florencia Silbering
2006-Mar-19 20:18 UTC
[R] Extracting numerical vectors from an array - use of multhist (plotrix)
Dear R community members, I am very new to R, so I hope I didn´t oversee the answer to my question in the manuals and faqs. 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)) The following error appears: Error in axis(side, at, labels, tick, line, pos, outer, font, vfont, lty, : no locations are finite (which is quite strange because if Iuse multhist with a list of numerical vectors it plots the histograms without need of specifying any of the above mentioned parameters). I would appreciate any suggestions. Thank you very much in advance. Ana --------------------------------------------------- Ana Florencia Silbering Departament of Biology - Universität Konstanz Universitätsstraße 10 - M11 D-78457 Konstanz Germany Tel.: (+49 7531) 88 - 4642 Fax: (+49 7531) 88 - 3894 email: anafs@zedat.fu-berlin.de --------------------------------------------------- [[alternative HTML version deleted]]
Ben Bolker
2006-Mar-20 03:24 UTC
[R] Extracting numerical vectors from an array - use of multhist (plotrix)
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