# NOT RUN {
# Load data
data(tura)
# 1- SpatialPoints case
# Generate SpatialPoints
sp <- sampleRegular(x = tura, size = 20, sp=TRUE)
# Run bfmSpOver with monitoring period starting year 2005 and all other default parameters of bfastmonitor
out <- bfmSpOver(tura, y = sp, start=c(2005,1))
# Visualize the results
plot(tura, 166)
# Build color palette
colfunc <- colorRampPalette(c("yellow", "red"))
colList <- colfunc(2013 - 2005)
points(out, col= colList[out$breakpoint - 2005], pch=16, cex = abs(out$magnitude/max(out$magnitude)))
# Color corresponds to timing of break and size to magnitude
# 2 - SpatialPolygons case
data(turaSp)
# Run bfmSpOver with monitoring period starting year 2002 and mean spatial aggregation function
out2 <- bfmSpOver(tura, y = turaSp, fun = mean, start=c(2002,1))
# Visualize
plot(tura, 166)
# Build color palette
colfunc <- colorRampPalette(c("yellow", "red"))
colList <- colfunc(2013 - 2002)
plot(out2, col = colList[out2$breakpoint - 2002], add = TRUE)
# Interpretation: The redder the latter the break was detected. If transparent, no break detected in spatially aggregated polygon time-series.
# }
Run the code above in your browser using DataLab