Description Usage Arguments Details Value See Also Examples
helps fix spelling mistakes in the labels of a set of samples.
1 2 3 4 5 6 7 8 |
x |
Object of class RasterLayer, RasterStack or RasterBrick. |
y |
Object of class SpatialPolygons or SpatialPolygonsDataFrame. |
z |
Object of class SpatialLines or SpatialLinesDataFrame. |
min.size |
Numeric element. |
priority |
Character vector. |
For each polygon in y, the function will determine the distance between its centroid and the nearest road provided through z, count the number of classes in x and the number of patches of connected pixels and report on the proportion of non NA values. The patch count can be restricted to those with a size greater min.size which specifies the minimum number of pixels per patch. Then, the function will use this data to rank the elements of y according to the order of the keywords in priority. The user can choose one or more of the following keywords:
diversity - Priority given to the highest Shannon, class diversity.
richness - Priority given to the highest class richness (number of classes in plot / total number of classes).
pixel_frequency - Priority given to the highest non-NA pixel count.
patch_count - Priority given to the highest patch count.
road_distance - Priority given to shortest distance.
The final output is a data.frame reporting on:
x - Polygon centroid x coordinate.
y - Polygon centroid y coordinate.
mape - Mean Absolute Percent Error.
diversity - Class diversity.
richness - Class richeness.
pixel.frequency - Number of non-NA pixels.
road.distance - Linear distance to the closest road.
ranking - Priority ranking
A list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | {
require(raster)
require(RStoolbox)
require(ggplot2)
# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))
# read road information
data(roads)
# unsupervised classification with kmeans
uc <- unsuperClass(r, nSamples=5000, nClasses=5)$map
# derive potential sampling plots
pp <- derivePlots(uc, 1000)
# plot ranking
pp@data <- rankPlots(uc, pp, roads)
# plot output
gp <- fortify(pp, region="ranking")
ggplot(gp, aes(x=long, y=lat, group=group, fill=as.numeric(id))) +
geom_polygon() + scale_fill_continuous(name="Ranking")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.