mult.arealw {AIGIS} | R Documentation |
Essentially a wrapper for arealw
, allowing the user to retrieve areal weights for multiple target polygons over the same list of zonal polygons. Permits calculations for all elements of a list of target polygons, or a those specified by vector indexing elements in that list. Depending on the calling options, returns the result as a list or matrix.
mult.arealw(target.ind = "all", targetlist = firepgpc, trimout = TRUE, zones = cabggpc, zbbmat = cabgbbmat, zoneareas = rbgarea, twokcensus = TRUE, digits = 6, verbose = 2)
target.ind |
A vector containing list indices of target polygons, or character “all”, which indicates the entire list is to be used. |
targetlist |
A list of possible target polygons |
trimout |
Logical indicating output format. See Value for details. |
zones |
List of zonal polygons for which fractional overlap is to be determined. |
zbbmat |
“Zonal bounding box matrix.” Either a matrix of dimension length(zones) by 4, or character “none”. If “none,” an appropriate matrix is automatically computed by a call to bbox.mat . See ‘Details.’ |
zoneareas |
A vector giving the area of each zone or character “none”, indicating they must be calculated inside the function. |
twokcensus |
Logical indicating whether the data in question is block group level data for California from the 2000 US Census. If ‘TRUE’, the function automatically handles certain ideosyncracies associated with that data. |
digits |
Digits argument passed to round internally. Used in setting the tolerance for considering fractional overlap to be 100 percent. Due to numerical issues, overlap will not always be identically 1 even when a zone is contained entirely within the target. There should be little reason to modify this away from the default value of six. |
verbose |
An integer indicating how frequently to print progress through the target polygons. Will print a message every time 10 to the verbose target polygons have been processed. Setting verbose negative results in no progress output. |
If not “none”, ‘zbbmat’ must take the form of a length(zones)
by 4 matrix, where each row corresponds to the bounding latitude and longitude values for polygons in ‘zones’, the same format returned by the function bbox.mat
. The columns correspond to low longitude, high longitude, low latitude and high latitude respectively.
If trimout equals 'FALSE', the function returns a matrix with number of rows equal to the number of zones, and columns equal to the number of target polygons specified by ‘target.ind’. Entry [i,j] then corresponds to the fractional overlap for of zone i in target polygon j. Since a large number of entries are likely to be zero, this is a wasteful storage method, but may be valuable as a convenient format with which to perform certain manual operations on the data.
Setting trimout equal to 'TRUE' returns a list of length equal to length(target.ind)
. Each element of the list is an ‘n’ by 2 matrix, where ‘n’ is the number of zones with nonzero overlap for that the target polygon associated with that list element. The first column contains the indices for those zones with overlap, and the second column contains the actual overlap weights.
Whatever object returned also has the ‘call’ attribute, allowing one to identify target polygons by their original index in the original unsubsetted polygon list.
The US Census 2000 data for California contains a mismatch between the number of block groups and the number of block group polygons. The code handles this provided twokcensus
is set to 'TRUE', but for all other datasets it as assumed that the number of datarecords is equal two the number of zones, and that the indexes match as well. If not, one or the other needs to be sorted appropriately.
Benjamin P. Bryant, bryant@prgs.edu
For general overview of areal interpolation and terminology, see Sadahiro, Y. Accuracy of areal interpolation: A comparison of alternative methods. Journal of Geographical Systems 1(4): 323-346 (1999).
data(cabgbbmat) data(cabggpc) data(fpdemogpc) data(rbgarea) data(polytobg) #Get two areal weights independently using arealw: fire1 <- arealw(fpdemogpc[[1]],trimout=TRUE) fire3 <- arealw(fpdemogpc[[3]],trimout=TRUE) #Stick them together and see if they match the output of mult.arealw, which #does them at the same time: stucktogether <- list(fire1,fire3) both <- mult.arealw(target.ind=c(1,3), targetlist = fpdemogpc, trimout=TRUE) attributes(stucktogether) <- NULL attributes(both) <- NULL #should be true: identical(both, stucktogether)