#' @title build a df of post probability and associated number of pixel and points
#' @author Melody Premaillon
#'
#' @param path folder path where raster is saved
#' @param name_rast_postprob name of susceptibility raster
#' @param name_shape name of point shapefile
#' @param name_rast_conf (optional) name of confidence raster
#' @param name_shape_val (optional) name of validation point shapefile
#'
#' @return a data frame order by descending post probability and the number of map pixel and point it represents
#' @export
#'
#' @import dplyr
build_df_postprobfreq <- function(path, name_rast_postprob, name_shape, name_rast_conf = "", name_shape_val = ""){
# loading data and create data frame from raster and shape(s)
rast_table <- extract_raster_postprob(path, name_rast_postprob, name_rast_conf)
shape_table <- extract_shape_postprob(path, name_shape, name_rast_postprob)
train_merge <- merge_rast_and_shape(rast_table, shape_table)
if (name_shape_val == ""){
df_postprob_freq <- train_merge
}else{
shapeval_table <- extract_shape_postprob(path, name_shape_val, name_rast_postprob)
val_merge <- merge_rast_and_shape(rast_table, shapeval_table, dataset = "valid")
df_postprob_freq <- train_merge %>%
left_join(val_merge)
}
return(df_postprob_freq)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.