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 38.214195 38.215498
#> 2 14.094118 14.095990
#> 3 14.337418 14.321255
#> 4 87.765884 87.761418
#> 5 9.922055 9.908949
#> 6 11.404808 11.412437