Convenience wrapper around jitter()
to add a layer of
anonymity to a query. This can be used in combination with anonymise()
to
produce a demo dataset from real data.
Arguments
- data
Data frame containing a query.
- cols
Character vector containing the metrics to jitter. When set to
NULL
(default), all numeric columns in the data frame are jittered.- ...
Additional arguments to pass to
jitter()
.
Value
data frame where numeric columns specified by cols
are jittered using the
function jitter()
.
Examples
jittered <- jitter_metrics(pq_data, cols = "Collaboration_hours")
# compare jittered vs original results of top rows
head(
data.frame(
original = pq_data$Collaboration_hours,
jittered = jittered$Collaboration_hours
)
)
#> original jittered
#> 1 14.12876 14.12758
#> 2 26.04322 26.04446
#> 3 25.72919 25.73000
#> 4 13.81522 13.81630
#> 5 16.22788 16.22753
#> 6 25.13330 25.13304