[R] sampling quadrats of increasing size in a list of matrices
Jens Oldeland
oldeland at gmx.de
Tue Jun 30 13:41:34 CEST 2009
Dear R-Users,
I have a problem and I have already surveyed different packages
especially in the Spatial-TASK view but did not find something
applicable. :(
I am looking for a solution on how to sample increasing sizes of
"quadrats" in a list of matrices. Each matrix is a binary raster map and
I want to know if there is a 1 or only 0 s in the sampling unit
(quadrat, e.g. 4x4 cells). This block has to vary in size so that each
time the area of the matrix (think of a map) is sampled, the areas I am
looking at are becoming larger. That means, in the first run cellsize
would 1x1 than 2x2 than 4x4 than 8x8 than 16x16 up to 64x64 which is the
final size of a matrix.
Furthermore, I need this done on a list object consisting of a set of
matrices, all with the same size (64x64). The list is 100 objects "tall".
The result should be a again a vector for each matrix with the length of
possible steps to sample the quadrat. This vector should report for each
sampling unit a 1 if there is a 1 somewhere otherwise the value should
be zero.
e.g. this is matrix number 90 from my list ( only showing a subset from
16 x16)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[,13] [,14] [,15] [,16]
[1,] 0 0 1 1 1 0 1 1 1 1 1 0
0 0 1 1
[2,] 0 1 1 1 0 1 0 1 1 0 1 1
1 1 1 1
[3,] 1 0 1 1 1 1 0 1 1 1 1 1
0 1 0 1
[4,] 0 0 0 0 1 0 0 1 1 0 1 1
1 1 1 1
[5,] 1 1 1 1 1 0 0 1 0 1 1 0
0 0 0 0
[6,] 1 0 1 1 0 0 0 0 0 1 1 1
1 0 1 1
[7,] 1 1 0 1 1 1 1 1 1 1 1 1
1 0 1 0
[8,] 1 1 1 1 1 0 1 0 1 1 1 0
1 1 1 1
[9,] 1 0 1 0 1 1 1 1 1 1 0 1
1 1 1 1
[10,] 1 1 1 1 1 1 1 0 1 0 0 0
0 1 1 1
[11,] 0 1 0 1 1 1 0 1 1 0 0 1
1 1 1 1
[12,] 1 1 1 1 0 1 1 1 1 1 0 1
1 1 0 0
[13,] 1 1 1 1 1 1 1 0 0 1 1 1
1 1 0 0
[14,] 1 1 0 1 1 0 0 1 0 0 1 1
1 0 1 1
[15,] 0 1 1 1 0 1 1 0 1 1 0 1
0 1 1 1
[16,] 0 1 1 0 1 0 1 1 1 0 1 1
1 1 0 0
with sample size of 2x2 (4 cells) one would need 64 steps to sample all 256
hence the result vector should have a length of 64. I think there is
only one spot row 4 col.6,7 row 5 col.6,7 that has only zeros.
increasing the sample size to 8x8 would need a vector of length 32,
possibly without any zero.
the matrices have an decreasing amount of 1s, so the rasters from 1-20
are more dominated by zeros.
in a second step; the sampling should be with a random nonoverlapping
placement of these sampling units. but I will post this question separately.
Your kind help will be highly appreciated!
Jens
--
+++++++++++++++++++++++++++++++++++++++++
Dipl.Biol. Jens Oldeland
University of Hamburg
Biocentre Klein Flottbek and Botanical Garden
Ohnhorststr. 18
22609 Hamburg,
Germany
Tel: 0049-(0)40-42816-407
Fax: 0049-(0)40-42816-543
Mail: Oldeland at botanik.uni-hamburg.de
Jens.Oldeland at DLR.de (for attachments > 2mb!!)
http://www.biologie.uni-hamburg.de/bzf/fbda005/fbda005.htm
+++++++++++++++++++++++++++++++++++++++++
More information about the R-help
mailing list