tangles: Anonymize spatial point patterns and raster objects

Description Usage Arguments Value Note Author(s) References Examples

View source: R/tangles.R

Description

Spatial coordinates are anonymized by using three possible techniques of altering locations without loss of the spatial relationships between data. The three techniques are vertical, horizontal and rotational shifts. User defines how many steps to use in the anonymization. The actual steps taken are randomized and saved for later use.

Usage

1
2
tangles(data=NULL, depth=3, rasterdata = FALSE, raster_object = FALSE, 
saveTangles = FALSE, path = NULL)

Arguments

data

Can be either a 2 column matrix of spatial coordinates or a raster object.

depth

numeric; the number of anonymization steps to take (levels of abstraction). Default is 3.

rasterdata

logical; If TRUE the rotational degrees will be taken as either 90, 180 or 270 degrees rather than randomly selected. This is to preserve the properties of a raster if raster data is to be anonymized.

raster_object

logical; If TRUE the data to be anonymized is a raster object. This means the data associated with the raster are carried through to the outputs.

saveTangles

logical; Save function output to file. Default is FALSE, but it is recommended to always save outputs.

path

character; Path to where outputs are saved.

Value

A list object that contains: 1. The transformed coordinates or transformed raster object (dependent on the inputs). 2. A separate list object to be used for untangling the transformed coordinates. The outputs can be written to file to a specified directory with file stub names of tangledXY and detangler respectively.These files have a common hash key as part of their file name.The hash key is generated from the detangler object using the sha256 hash algorithm

Note

Raster data can in practice be rotated for any given angle, yet the linear horizontal and vertical properties of the raster will be lost, meaning that no software will be able to recognize it as a raster. This why there is the rasterdata parameter exists, and can be used for both raster and non-raster data. It just constrains the possible degree values that can be used in the anonymization. If raster data is being anonymized both rasterdata and raster_object will be set to TRUE in most cases.

The most important output to come from this function is the detangler object (saved to file with unique hash key), as this encodes the anonymization steps that can be used for re-identification, or anonymization of associated data. This enables parties to share pertinent information without the requirement to share actual spatial coordinates.

tangles is coordinate reference system agnostic. Anonymization will proceed regardless of whether data is in geographic or projected space. Anonymized coordinates will not exist in reality, but the spatial properties of the original data will be maintained.

Author(s)

Brendan Malone

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## POINT DATA
library(digest)
data("HV_subsoilpH")
str(HV_subsoilpH)
dat.xy<- HV_subsoilpH[,1:2]
xyData<- as.matrix(dat.xy)

# anonymize with 5 levels of abstraction
tangles.out<- tangles(data = xyData, 
depth = 5, 
rasterdata = FALSE, 
raster_object = FALSE, 
saveTangles = FALSE)

str(tangles.out)  
head(tangles.out[[1]])

## RASTER DATA
library(raster)
data("hunterCovariates_sub")
str(hunterCovariates_sub)
raster_object<- hunterCovariates_sub

tangles.out<- tangles(data = hunterCovariates_sub, 
depth = 5, 
rasterdata = TRUE, 
raster_object = TRUE,
saveTangles = FALSE)

str(tangles.out)

tangles documentation built on Oct. 11, 2019, 5:06 p.m.