R/mdgp_scale.R
mdgp_scale.Rd
Classify relative abundance samples to multi-dimensional grid points and calculate percent information retention for each scaled grid cell
mdgp_scale(x, parts, rpr_threshold, monotypic_threshold, verbose = FALSE)
data frame with relative abundance of classes in columns generated with function relative_abundance_scaled_grid()
integer that sets the class label precision of scaled classes. OPTIONS: 1 = 100%, 2 = 50%, 3 = 33.3%, 4 = 25%, 5 = 20%
integer setting the representativeness threshold, the minimum percentage of a mixed class in the scaled landscape to be retained in the classification scheme
integer that sets the minimum percentage of a class to be considered monotypic and therefore retained in the scaled classification scheme
bolean; if TRUE progress will be printed in console; default = FALSE
A data frame with first column containing the scaled category IDs followed by the original class columns with relative class abundance in percent. The last three columns are x_y = concatenated x and y coordinates, prc_inf_agr = percent information retained for each scaled grid cell, and class_name = the class labels of the scaled classes
# load categorical raster
r <- terra::rast(system.file("extdata/nlm_mid_geom_r3_sa0.tif", package = "landscapeScaling"))
# subset the raster to the lower 300 by 300 pixels
r_sub <- terra::crop(r,terra::ext(0,300,0,300))
# generate relative abundance for the scaled grid
rel_abund <- relative_abundance_scaled_grid(r_sub,class_field='cover',scale_factor=15)
head(rel_abund)
#> x y A B C
#> 1 0 0 4.8888889 38.22222 56.88889
#> 2 15 0 10.2222222 38.66667 51.11111
#> 3 30 0 20.0000000 42.66667 37.33333
#> 4 45 0 24.8888889 40.44444 34.66667
#> 5 60 0 0.8888889 28.00000 71.11111
#> 6 75 0 17.7777778 37.33333 44.88889
# classify relative abundance samples to multi-dimensional grid points
# class-label precision = 33.3% (parts=3),
# minimum representativeness = 10% and a monotypic threshold 90%
mdgp_result <- mdgp_scale(rel_abund,parts=3,rpr_threshold=10,monotypic_threshold=90)
#> [1] "number of cells: 400"
#> [1] "number of grid points: 10"
#> [1] "number of grid points remaining: 5"
head(mdgp_result)
#> cls A B C x_y prc_inf_agr class_name
#> 1 10 0.000 8.444 91.556 285_0 91.556 C100
#> 2 10 0.000 9.333 90.667 195_30 90.667 C100
#> 3 10 0.444 12.444 87.111 60_285 87.111 C100
#> 4 9 4.889 38.222 56.889 0_0 90.222 C67_x_B33
#> 5 9 10.222 38.667 51.111 15_0 84.444 C67_x_B33
#> 6 9 10.667 42.667 46.667 225_0 80.000 C67_x_B33