Description Usage Arguments Value Examples
Take elements from a vector. Useful for extracting an index from branches in a parse tree, particularly, in a magrittr chain.
1 | take(x, indices = 1)
|
x |
A vector of elements to select from. |
indices |
The indices to select. |
Returns a subset of the original set of elements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | take(list(1:4, LETTERS, rnorm(10)))
take(list(1:4, LETTERS, rnorm(10)), 2)
take(list(1:4, LETTERS, rnorm(10)), 1:3)
## Not run:
## Parse example
txt <- c(
"Really, I like chocolate because it is good. It smells great.",
"Robots are rather evil and most are devoid of decency.",
"He is my friend.",
"Clifford the big red dog ate my lunch.",
"Professor Johns can not teach",
"",
NA
)
if(!exists('parse_ann')) {
parse_ann <- parse_annotator()
}
(x <- parser(txt, parse_ann))
get_phrase_type(x, "NP") %>%
take() %>%
get_leaves()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.