Title: | Create Unique Pseudonymous Animal Names |
---|---|
Description: | Generate pseudonymous animal names that are delightful and easy to remember like the Likable Leech and the Proud Chickadee. A unique pseudonym can be created for every unique element in a vector or row in a data frame. Pseudonyms can be customized and tracked over time, so that the same input is always assigned the same pseudonym. |
Authors: | Tobias Busch [aut, cre] |
Maintainer: | Tobias Busch <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-10-25 05:02:33 UTC |
Source: | https://github.com/teebusch/noah |
Add column with pseudonyms to a data frame
add_pseudonyms( .data, ..., .name = "pseudonym", .before = NULL, .after = NULL, .ark = NULL )
add_pseudonyms( .data, ..., .name = "pseudonym", .before = NULL, .after = NULL, .ark = NULL )
.data |
A data frame to add pseudonyms to. |
... |
Columns to use as keys on which pseudonyms should be based. Supports tidy select. If empty, all columns will be used. |
.name |
Name of the new column as string. |
.before |
< |
.after |
< |
.ark |
An Ark object. If NULL (default) a new Ark is created. Using an existing Ark makes sure that the same input returns the same pseudonym. |
A data frame with an additional column containing the pseudonyms.
add_pseudonyms(mtcars)
add_pseudonyms(mtcars)
An Ark object can create and remember pseudonyms. Given the same input, it will always return the same pseudonym. No pseudonym will repeat.
log
Hashtable for all used pseudonyms. Inputs (keys) are stored as hashes.
new()
Create new ark object.
Ark$new(alliterate = FALSE, parts = NULL, seed = NULL)
alliterate
Logical. Should the Ark return alliterations by default?
parts
List of character vectors with name parts to be used for the pseudonyms. Defaults to adjectives and animals.
seed
Random seed for permutation of name parts. Use this to make
Ark reproducible (to the extent that the random number generation is
reproducible). If NULL (default), the random number generator is left
alone. This is a convenience argument and equivalent to calling
set.seed()
before creating the Ark.
A new Ark
object.
pseudonymize()
Create Pseudonyms for input.
Ark$pseudonymize(..., .alliterate = NULL)
...
One or more R objects.
.alliterate
Logical. Return only pseudonyms that are
alliterations. Defaults to TRUE if the Ark was created with
Ark$new(alliterate = TRUE)
, FALSE otherwise. If FALSE, pseudonyms
may still be alliterations by coincidence.
Character vector of pseudonyms with same length as input.
print()
Pretty-print an Ark object.
Ark$print(n = NULL)
n
A positive integer. The number of example pseudonyms to print.
length()
Number of used pseudonyms in an Ark.
Ark$length()
length_allit()
Number of used alliterations in an Ark.
Ark$length_allit()
clone()
The objects of this class are cloneable with this method.
Ark$clone(deep = FALSE)
deep
Whether to make a deep clone.
Pseudonymize returns unique pseudonyms for R objects. It accepts any number of vectors and data frame as arguments and will use them as keys for the pseudonym creation. Vectors and data frames must have identical length. Elements in the same position or row are treated as part of the same key. The same key is always assigned the same pseudonym. Different keys are always assigned different pseudonyms.
pseudonymize(..., .alliterate = NULL, .ark = NULL)
pseudonymize(..., .alliterate = NULL, .ark = NULL)
... |
One or multiple objects to use as keys for which pseudonyms should be created, usually one or more columns of a data frame. All objects must be of the same length. |
.alliterate |
Logical. Should only pseudonyms that are alliterations be
returned? Defaults to FALSE, or TRUE if set as TRUE for the Ark provided to
|
.ark |
An Ark object. If NULL (default) a new Ark is created. Using an existing Ark makes sure that the same input returns the same pseudonym. |
A character vector of pseudonyms.
pseudonymize("Mata Hari")
pseudonymize("Mata Hari")