Skip to contents

Returns the role each column of the clone was masked under, in the clone's own vocabulary: one row per column of synthetic(), in the same order and under the same names. When the column names were aliased (alias_names in mask()), the rows carry the aliases, so the table can travel with the clone without disclosing the original names. A dropped column is not in the clone and has no row.

Usage

roles(m)

Arguments

m

A masque object from mask(), or a masque_set from mask_set().

Value

For a masque, a data.table with columns col, role, action and kind. For a masque_set, a named list of such tables, one per table of the set.

Details

Only the four public columns are returned. The proposal's notes and its value summaries describe the original table and stay on the private recipe, as does the full role table used on the original (recipe(m)@roles).

Examples

r <- propose_roles(iris)
r <- set_role(r, "Sepal.Length", role = "outcome")
m <- mask(iris, r, seed = 1)
roles(m)
#>             col      role   action    kind
#>          <char>    <char>   <char>  <char>
#> 1: Sepal.Length   outcome scramble numeric
#> 2:  Sepal.Width covariate scramble numeric
#> 3: Petal.Length covariate scramble numeric
#> 4:  Petal.Width covariate scramble numeric
#> 5:      Species covariate scramble  factor