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.

jitter_metrics(data, cols = NULL, ...)

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().

See also

anonymise

Examples

jittered <- jitter_metrics(sq_data, cols = "Collaboration_hours")
head(
  data.frame(
    original = sq_data$Collaboration_hours,
    jittered = jittered$Collaboration_hours
  )
)
#>   original jittered
#> 1 18.74210 18.74317
#> 2 15.02403 15.02249
#> 3 14.27897 14.27962
#> 4 12.69034 12.68956
#> 5 10.99079 10.98916
#> 6 18.25287 18.25231