| calcSummary | R Documentation |
Apply functions to polygons in a PolySet.
calcSummary (polys, rollup = 3, FUN, ...)
polys |
PolySet to use. |
rollup |
level of detail in the results; |
FUN |
the function to apply; it must accept a vector and return a vector or scalar. |
... |
optional arguments for |
If rollup equals 1, the results contain an entry for
each unique PID only. When it equals 2, they contain
entries for outer contours only. Finally, setting it to 3
prevents roll-up, and they contain an entry for each unique
(PID, SID).
PolyData with columns PID, SID (may be missing),
X, and Y. If FUN returns a vector of length
greater than 1 (say n), names the columns X1, X2,
..., Xn and Y1, Y2, ..., Yn.
Nicholas M. Boers, Staff Software Engineer
Jobber, Edmonton AB
Last modified Rd: 2013-04-10
calcArea,
calcCentroid,
calcConvexHull,
calcLength,
calcMidRange,
combineEvents,
findPolys,
locateEvents,
locatePolys,
makeGrid,
makeProps.
local(envir=.PBSmapEnv,expr={
#--- load the data (if using R)
if (!is.null(version$language) && (version$language=="R"))
data(nepacLL,envir=.PBSmapEnv)
#--- calculate and print the centroids for several polygons
print(calcSummary(nepacLL[is.element(nepacLL$PID,c(33,39,47)),],
rollup=3, FUN=mean))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.