if (bayes_run_examples()) {
# get the probability file
data_dir <- system.file("/extdata/probs/", package = "bayesEO")
file <- list.files(data_dir)
# build the full path
probs_file <- paste0(data_dir, "/", file)
# include the labels
labels <- c("Water", "ClearCut_Burn", "ClearCut_Soil",
"ClearCut_Veg", "Forest", "Wetland")
# associate the labels to the names of the SpatRaster
probs <- bayes_read_probs(probs_file, labels)
# calculate the variance
var <- bayes_variance(probs)
# Plot the variance image
bayes_plot_var(var,
n = 15,
style = "order",
quantile = 0.75,
palette = "YlGn",
labels = c("Forest", "ClearCut_Veg"))
}
Run the code above in your browser using DataLab