
Last chance! 50% off unlimited learning
Sale ends in
# NOT RUN {
{
require(raster)
require(fieldRS)
# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))
# read field data
data(fieldData)
fieldData <- fieldData[3:4,]
# find polygon clusters
k <- splitSamples(fieldData, r, fieldData$crop, agg.radius=30)
fieldData$ID <- as.factor(k$region.id)
# plot regions with labels
spplot(fieldData["ID"])
# show pixel count per region
head(k$region.frequency)
}
# }
Run the code above in your browser using DataLab