Create a binary raster with sensitive locations.
Arguments
- x
sdc_rasterobject.- max_risk
a risk value higher than
max_riskwill be sensitive.- min_count
a count lower than
min_countwill be sensitive.- risk_type
what kind of measure should be used (see details).
Details
By default the risk settings are taken from x, but they can be overriden.
Different risk functions can be used:
external (numeric variable), calculates how much the largest value comprises the total sum
internal (numeric variable), calculates how much the largest value comprises the sum without the second largest value
discrete (logical variable), calculates the fraction of sensitive values.
See also
Other sensitive:
disclosure_risk(),
is_sensitive_at(),
plot_sensitive(),
remove_sensitive(),
sdc_raster(),
sensitivity_score()
Examples
# \donttest{
dwellings_sp <- dwellings
sp::coordinates(dwellings_sp) <- ~ x + y
tryCatch(
# does not work on some OS versions
sp::proj4string(dwellings_sp) <- "+init=epsg:28992"
)
# create a 1km grid
unemployed <- sdc_raster(dwellings_sp, dwellings_sp$unemployed, r = 1e3)
print(unemployed)
#> logical sdc_raster object:
#> resolution: 1000 1000 , max_risk: 0.95 , min_count: 10
#> mean sensitivity score [0,1]: 0.2767296
# retrieve the sensitive cells
is_sensitive(unemployed)
#> class : RasterLayer
#> dimensions : 14, 13, 182 (nrow, ncol, ncell)
#> resolution : 1000, 1000 (x, y)
#> extent : 149000, 162000, 457000, 471000 (xmin, xmax, ymin, ymax)
#> crs : +proj=sterea +lat_0=52.1561605555556 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs
#> source : memory
#> names : sensitive
#> values : 0, 1 (min, max)
#>
# }