View source: R/assess_privacy.r
assess_privacy | R Documentation |
At this time, data with privacy considerations must be aggregated such that each polygon has a minimum of 5 unique values for sensitive fields like Licenses, License Holders, and Vessels. This function takes a dataframe and shapefile and for each polygon in the shapefile calculates 1) aggregate values for a number of (user-specified) fields , and 2) how many unique values exist in each polygon for each of a number of sensitive fields.
assess_privacy(
df = NULL,
grid.shape = "hex",
lat.field = "LATITUDE",
lon.field = "LONGITUDE",
rule.of = 5,
agg.fields = "KEPT_WT",
calculate = c("MEAN", "COUNT", "SUM"),
sens.fields = NULL,
facet.field = NULL,
key.fields = NULL,
for.public = TRUE,
create.spatial = TRUE,
create.centroid.csv = FALSE,
file.id = NULL,
agg.poly.shp = NULL,
agg.poly.field = NULL,
custom.grid = NULL
)
df |
a dataframe to be analyzed. If left |
grid.shape |
default is |
lat.field |
the default is |
lon.field |
the default is |
rule.of |
default is |
agg.fields |
the default is |
calculate |
the default is |
sens.fields |
the defaults are |
facet.field |
default is |
key.fields |
default is |
for.public |
default is |
create.spatial |
default is |
create.centroid.csv |
default is |
file.id |
default is |
agg.poly.shp |
default is |
agg.poly.field |
default is |
custom.grid |
default is |
a list containing an sf grid layer, an sf overlay later, and if create.spatial==T
,
a gpkg spatial file containing these same objects. Additionally, if create.centroid.csv =T
,
it can also produce a csv of the centroids of the grid layer (which willl also be loaded into the
gpkg file).
If sensitive fields have names that are different than what is provided in the sen.fields
,
they will not be detected, or included in the checks. Please make very sure you correctly
identify such fields.
It should be also noted that this function can result in spatial files with 100s of columns
relatively easily when a facet.field
is provided (e.g. for bycatch species). For example,
if all 3 default calculate
fields are requested on 3 different agg.fields
, and
there are 30 unique values in the facet.field
, this will result in (3*3*30 =) 270
fields plus 3 or 4 additional housekeeping fields.
Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca
Other privacy:
plot_hex_data()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.