Tarmo Remmel wrote on 09/20/2011 09:51:45 AM:
> 
> Hello list members,
> 
> I am working with simulated data for landscape pattern analysis.  I have
> 1000 replicates of binary (2 colour) gridded landscapes at each 
combination
> of 9 levels of class proportion and 11 levels of spatial 
autocorrelation.
> The results are stored in an array as follows:
> 
> > dim(surfaces)
> [1]   38    9   11 1000
> 
> The dimensions are defined as follows:
> [x,,,] 1:38, integers that identify a measurement type (landscape 
pattern
> metrics)
> [,x,,] 1:9, integers that identify levels of class proportion
> [,,x,] 1:11, integers that identify levels of spatial autocorrelation
> [,,,x] floating point values for the specific landscape metric
> 
> I would like a simple way to produce boxplots of the 1000 metric values 
for
> a specific landscape metric and level of spatial autocorrelation across 
the
> 9 levels of proportion.  Thus, I want to fix the first dimension (say as 
10)
> and fix the third dimension (say as 1), and then use the second 
dimension as
> factors (1:9) to produce boxplots of the values in the 4th dimension. Is
> there a simple way to do this? 
> 
> I have been playing with boxplot() and apply() but am getting some
> dimensions mixed up and thought that this would be a good time to seek 
some
> help.  Any help with this would be greatly appreciated.
> 
> Thank you,
> 
> Tarmo
> 
> 
> _____________________________________
> Tarmo K Remmel PhD
> Associate Professor, Department of Geography
> York University, N413A Ross Building
> 4700 Keele Street, Toronto, Ontario, M3J 1P3
> Tel: 416-736-2100 x22496, Fax: 416-736-5988
> Skype: tarmoremmel


Try this:

mybox <- function(arr, type, autocorr) {
        y <- arr[type, , autocorr, ]
        class <- as.factor(as.vector(row(y)))
        metric <- as.vector(y)
        plot(class, metric)
        }

mybox(surfaces, 10, 1)

Jean

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to