Split row and column labels into nouns and prepositional phrases
split_noun_pp.Rd
This function is similar to split_pref_suff()
in that it returns a list.
However, this function's list is more detailed than
split_pref_suff()
.
The return value from this function is a list
with the first named item being the prefix (with the name noun
)
followed by objects of prepositional phrases
(with names being prepositions that precede the objects).
Usage
split_noun_pp(
labels,
inf_notation = TRUE,
notation = RCLabels::notations_list,
choose_most_specific = FALSE,
prepositions = RCLabels::prepositions_list
)
Arguments
- labels
The row and column labels from which prepositional phrases are to be extracted.
- inf_notation
A boolean that tells whether to infer notation for
x
. Default isTRUE
. Seeinfer_notation()
for details.- notation
The notation type to be used when extracting prepositions. Default is
RCLabels::notations_list
, meaning that the notation is inferred usinginfer_notation()
.- choose_most_specific
A boolean that tells whether to choose the most specific notation from
notation
when inferring notation. Default isFALSE
so that a less specific notation can be inferred. In combination withRCLabels::notations_list
, the default value ofFALSE
means thatRCLabels::bracket_notation
will be selected instead of anything more specific, such asRCLabels::from_notation
.- prepositions
A vector of strings to be treated as prepositions. Note that a space is appended to each word internally, so, e.g., "to" becomes "to ". Default is
RCLabels::prepositions_list
.
Details
Unlike split_pref_suff()
, it does not make sense to have a transpose
argument on split_noun_pp()
.
Labels may not have the same structure,
e.g., they may have different prepositions.
Examples
# Specify the notation
split_noun_pp(c("a [of b in c]", "d [of e into f]"),
notation = bracket_notation)
#> [[1]]
#> noun of in
#> "a" "b" "c"
#>
#> [[2]]
#> noun of into
#> "d" "e" "f"
#>
# Infer the notation via default arguments
split_noun_pp(c("a [of b in c]", "d [of e into f]"))
#> [[1]]
#> noun of in
#> "a" "b" "c"
#>
#> [[2]]
#> noun of into
#> "d" "e" "f"
#>