tidy_keyword(
...,
min_chars = 1,
delimiter = ",",
enclosure = "double quote",
clean_modifiers = TRUE,
sort = FALSE,
na_rm = TRUE,
duplicate_rm = TRUE
)
One or more character
objects containing keywords.
(optional) A number indicating the minimal number of
characters a keyword must have. Keywords that don't comply to this setting
will be transformed to NA
(default: 1
).
(optional) A string with the delimiter used on ...
values.
Use delimiter = NULL
to disable this behavior (default: NULL
).
(optional) A string indicating the type of enclosure for
keywords with special characters (like spaces) (default: "double quote"
).
(optional) A logical
value indicating if keywords
with modifiers must be transformed to NA
(default: TRUE
).
(optional) A logical
value indicating if the output must be
ordered alphabetically (default: FALSE
).
(optional) A logical
value indicating if NA
values must be
removed from the output (default: TRUE
).
(optional) A logical
value indicating if duplicate
values must be removed from the output (default: TRUE
).
A character
object with keywords in ...
tidied.
enclosure
argumentThe enclosure
argument let you choose the type of enclosure for keywords
with special characters, i.e, all keywords that don't conform to the
pattern "^[a-zA-Z0-9]+$"
. The default value is "double quote"
.
Valid choices for this argument are:
"single quote"
: to enclose the keyword with single quotes (e.g.,
'lorem'
)
"double quote"
: to enclose the keyword with double quotes (e.g.,
"ipsum"
)
"round bracket"
: to enclose the keyword with round brackets or
parenthesis (e.g. (dolor)
)
"curly bracket"
: to enclose the keyword with curly brackets (e.g.
{dolor}
)
"square bracket"
: to enclose the keyword with square brackets (e.g.
[dolor]
)
Other keyword functions:
query()
tidy_keyword("Lorem", "Ipsum dolor", c("sit", "amet"))
#> [1] "lorem" "\"ipsum dolor\"" "sit" "amet"
#> [1] "lorem" "\"ipsum dolor\"" "sit" # Expected
#> [4] "amet" # Expected
tidy_keyword("Lorem", "Ipsum dolor", c("sit", "amet"), sort = TRUE)
#> [1] "amet" "\"ipsum dolor\"" "lorem" "sit"
#> [1] "amet" "\"ipsum dolor\"" "lorem" # Expected
#> [4] "sit" # Expected
tidy_keyword("Lorem", "Ipsum, dolor", delimiter = ",")
#> [1] "lorem" "ipsum" "dolor"
#> [1] "lorem" "ipsum" "dolor" # Expected
tidy_keyword("Lorem", "Ipsum*", clean_modifiers = TRUE, na_rm = TRUE)
#> [1] "lorem"
#> [1] "lorem" # Expected
tidy_keyword("Lorem", "Ipsum*", clean_modifiers = TRUE, na_rm = FALSE)
#> [1] "lorem" NA
#> [1] "lorem" NA # Expected