-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
67 lines (47 loc) · 1.9 KB
/
README.Rmd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# simplanonym <img src="man/figures/logo.png" align="right" height="139" />
<!-- badges: start -->
<!-- badges: end -->
The goal of simplanonym is to easily anonymise individuals that appear in multiple datasets, in a consistent way.
Consistent anonymisation means that:
* each unique individual gets the same single anonymised factor, even if appearing in more than one dataset;
* the same anonymised factor always refers back to the same individual.
## Installation
You can install the development version of simplanonym from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("dkgaraujo/simplanonym")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
library(simplanonym)
rand_tbl_1 <- vroom::gen_tbl(10, 4, col_types = "fffd")
rand_tbl_2 <- vroom::gen_tbl(10, 2, col_types = "fd")
rand_tbl_2$X3 <- rand_tbl_1$X3
# note:
# * rand_tbl_1 and rand_tbl_2 share three column names,
# of which X2 is a factor in one but not the other.
# * X1 factors do not overlap, but their anonymisation
# should still be consistent (ie, different levels should
# have their own unique anonymised factors).
# * For X3, the anonymised factors should consider the levels
# at both `rand_tbl_1$X3` and `rand_tbl_2$X3`.
data_list <- list(rand_tbl_1, rand_tbl_2)
data_list
data_list |> anonymise(return_original_levels = TRUE)
```
## Acknowledgements
The hex sticker for the package is based on an icon provided free of charge by www.flaticon.com.
<a href="https://www.flaticon.com/free-icons/rene-magritte" title="rené magritte icons">René magritte icons created by Freepik - Flaticon</a>