Extract attributes and aggregate cumulative effects assessment results
cea_extract.Rd
Function to extract specific drivers and vc of interest from the drivers, valued component, exposure and cumulative effects assessments results, and to aggregate data over drivers, valued components, or drivers and valued components.
Arguments
- dat
stars object, either the drivers, valued components, exposure, cumulative effects assessment or network-sacale cumulative effects assessment results
- dr_sel
string, name of drivers to extract
- vc_sel
string, name of valued components to extract
- cumul_fun
function to apply on the stars object, one of "drivers" for the cumulative effects of each drivers on all value components, "vc" for the cumulative effects of all drivers on each valued component, "full" for the cumulative effects of all drivers on all valued components, "footprint" for the cumulative footprint of drivers or valued components, and "none" to keep data as is, i.e. to extract specific drivers and valued components from the assessment results.
Examples
# Data
drivers <- rcea:::drivers
vc <- rcea:::vc
sensitivity <- rcea:::sensitivity
# Cumulative effects assessment
dat <- cea(drivers, vc, sensitivity, "stars")
# Extract attributes
dr_sel <- c("driver1","driver5")
vc_sel <- c("vc4","vc7","vc10","vc12")
cea_extract(dat, dr_sel = dr_sel, vc_sel = vc_sel)
#> stars object with 3 dimensions and 4 attributes
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
#> vc4 0.07012614 0.1451942 0.4022893 0.3566048 0.5065445 0.8237497 3657
#> vc7 0.08427606 0.1846463 0.3120659 0.3058532 0.4161193 0.5804424 3810
#> vc10 0.15005458 0.3687080 0.4638575 0.5160180 0.6737182 0.9928748 3696
#> vc12 0.00000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 3757
#> dimension(s):
#> from to offset delta values x/y
#> x 1 45 -100 5 NULL [x]
#> y 1 45 125 -5 NULL [y]
#> drivers 1 2 NA NA driver1, driver5
# Cumulative footprint of selected drivers and valued components
cea_extract(drivers, dr_sel = dr_sel, cumul_fun = "footprint")
#> stars object with 2 dimensions and 1 attribute
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> cumulative_footprint 0 0 0 0.3200989 0.6082802 1.731633
#> dimension(s):
#> from to offset delta x/y
#> x 1 45 -100 5 [x]
#> y 1 45 125 -5 [y]
cea_extract(vc, vc_sel = vc_sel, cumul_fun = "footprint")
#> stars object with 2 dimensions and 1 attribute
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> cumulative_footprint 0 0 1 1.083457 2 4
#> dimension(s):
#> from to offset delta x/y
#> x 1 45 -100 5 [x]
#> y 1 45 125 -5 [y]
# Cumulative effects of all drivers on all vc
cea_extract(dat, cumul_fun = "drivers")
#> stars object with 2 dimensions and 10 attributes
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> driver1 0 0 0 0.4539324 0.8480668 3.859231
#> driver10 0 0 0 0.7130826 1.3788735 4.893114
#> driver2 0 0 0 0.1172817 0.0000000 2.413071
#> driver3 0 0 0 0.6557617 1.2542816 5.316093
#> driver4 0 0 0 0.2484260 0.0000000 4.319397
#> driver5 0 0 0 0.2501246 0.0000000 4.322386
#> driver6 0 0 0 0.3177023 0.0000000 3.690482
#> driver7 0 0 0 0.3622950 0.6198464 3.908189
#> driver8 0 0 0 0.3627519 0.1927599 4.203816
#> driver9 0 0 0 0.4047631 0.7306683 3.509189
#> dimension(s):
#> from to offset delta x/y
#> x 1 45 -100 5 [x]
#> y 1 45 125 -5 [y]
# Cumulative effects of all drivers on each vc
cea_extract(dat, cumul_fun = "vc")
#> stars object with 2 dimensions and 20 attributes
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> vc1 0 0 0 0.16563179 0.00000000 2.685106
#> vc2 0 0 0 0.08708005 0.00000000 2.011935
#> vc3 0 0 0 0.16188552 0.00000000 1.942717
#> vc4 0 0 0 0.30384288 0.49278781 2.956124
#> vc5 0 0 0 0.18176312 0.00000000 2.378030
#> vc6 0 0 0 0.23890513 0.00000000 2.284281
#> vc7 0 0 0 0.17997906 0.00000000 2.513321
#> vc8 0 0 0 0.11676263 0.00000000 2.066466
#> vc9 0 0 0 0.21690132 0.05165895 2.209173
#> vc10 0 0 0 0.27848653 0.50509175 2.520944
#> vc11 0 0 0 0.36592681 0.71713361 2.798803
#> vc12 0 0 0 0.19422772 0.00000000 2.488768
#> vc13 0 0 0 0.09180124 0.00000000 1.182442
#> vc14 0 0 0 0.15362652 0.00000000 2.133657
#> vc15 0 0 0 0.13475932 0.00000000 2.265969
#> vc16 0 0 0 0.22228674 0.00000000 2.369847
#> vc17 0 0 0 0.15478093 0.12446228 1.788019
#> vc18 0 0 0 0.16735075 0.21526754 1.734678
#> vc19 0 0 0 0.29945482 0.50017858 2.345047
#> vc20 0 0 0 0.17066849 0.10875808 1.855104
#> dimension(s):
#> from to offset delta x/y
#> x 1 45 -100 5 [x]
#> y 1 45 125 -5 [y]
# Full cumulative effects
cea_extract(dat, cumul_fun = "full")
#> stars object with 2 dimensions and 1 attribute
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> cumulative_effects 0 2.279211 3.527187 3.886121 5.097251 16.90593
#> dimension(s):
#> from to offset delta x/y
#> x 1 45 -100 5 [x]
#> y 1 45 125 -5 [y]