This helper provides a single place to inspect and update the supported
anon.* global options. It aligns with base options() behavior: calling
it with no arguments returns the current option values, and calling it with
one or more arguments sets those options and invisibly returns their previous values.
Usage
anon_options(
default_replacement,
pattern_list,
df_variable_names,
df_classes,
nlp_auto,
nlp_default_replacements,
example_values_n,
example_rows
)Arguments
- default_replacement
Default replacement text used by
anon()and NLP helpers when no more specific replacement is provided. Stored inanon.default_replacement.- pattern_list
Global pattern rules combined with function-level
pattern_listvalues. Stored inanon.pattern_list.- df_variable_names
Global variable-name rules combined with function-level
df_variable_names. Stored inanon.df_variable_names.- df_classes
Global class-based rules combined with function-level
df_classes. Stored inanon.df_classes.- nlp_auto
NLP auto-redaction configuration stored in
anon.nlp_auto. Usenlp_auto()to build this value.- nlp_default_replacements
Default NLP replacement labels stored in
anon.nlp_default_replacements. Usenlp_default_replacements()to build this value.- example_values_n
Default
example_values_nused byanon_data_summary()andanon_report(). Stored inanon.example_values_n.- example_rows
Default
example_rowsspec used byanon_data_summary()andanon_report(). Stored inanon.example_rows. Useanon_example_rows()to build this value.
Value
If called with no arguments, a named list of current supported
anon.* options. Otherwise, the previous values for the updated options,
returned invisibly with the same values as options().
Details
Supported options are:
anon.default_replacementanon.pattern_listanon.df_variable_namesanon.df_classesanon.nlp_autoanon.nlp_default_replacementsanon.example_values_nanon.example_rows
Use NULL to clear an option. For structured option values, these helpers
are available:
Examples
anon_options()
#> $anon.default_replacement
#> NULL
#>
#> $anon.pattern_list
#> $anon.pattern_list$EMAIL
#> [1] "@\\S+"
#>
#>
#> $anon.df_variable_names
#> [1] "name"
#>
#> $anon.df_classes
#> NULL
#>
#> $anon.nlp_auto
#> NULL
#>
#> $anon.nlp_default_replacements
#> NULL
#>
#> $anon.example_values_n
#> NULL
#>
#> $anon.example_rows
#> NULL
#>
old <- anon_options(
default_replacement = "[HIDDEN]",
example_values_n = 2,
example_rows = anon_example_rows(n = 3, method = "random", seed = 11)
)
options(old)
