Skip to content

Commit 87d90fc

Browse files
authored
Clarification on arg order (#239)
1 parent 8215780 commit 87d90fc

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ Config/testthat/edition: 3
7474
Encoding: UTF-8
7575
LazyData: TRUE
7676
Roxygen: list(markdown = TRUE)
77-
RoxygenNote: 7.2.2
77+
RoxygenNote: 7.2.3

R/unnest_tokens.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@
7070
#' d
7171
#'
7272
#' d %>%
73-
#' unnest_tokens(word, txt)
73+
#' unnest_tokens(output = word, input = txt)
7474
#'
7575
#' d %>%
76-
#' unnest_tokens(sentence, txt, token = "sentences")
76+
#' unnest_tokens(output = sentence, input = txt, token = "sentences")
7777
#'
7878
#' d %>%
79-
#' unnest_tokens(ngram, txt, token = "ngrams", n = 2)
79+
#' unnest_tokens(output = ngram, input = txt, token = "ngrams", n = 2)
8080
#'
8181
#' d %>%
8282
#' unnest_tokens(chapter, txt, token = "regex", pattern = "Chapter [\\\\d]")

man/tidytext-package.Rd

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/unnest_tokens.Rd

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/tidytext.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ original_books <- austen_books() %>%
4949
original_books
5050
```
5151

52-
To work with this as a tidy dataset, we need to restructure it as **one-token-per-row** format. The `unnest_tokens` function is a way to convert a dataframe with a text column to be one-token-per-row:
52+
To work with this as a tidy dataset, we need to restructure it as **one-token-per-row** format. The `unnest_tokens` function is a way to convert a dataframe with a text column to be one-token-per-row. Here let's tokenize to a new `word` column from the existing `text` column:
5353

5454
```{r}
5555
library(tidytext)
5656
tidy_books <- original_books %>%
57-
unnest_tokens(word, text)
57+
unnest_tokens(output = word, input = text)
5858
5959
tidy_books
6060
```
@@ -188,7 +188,7 @@ is a sad sentence, not a happy one, because of negation. The [Stanford CoreNLP](
188188

189189
```{r}
190190
PandP_sentences <- tibble(text = prideprejudice) %>%
191-
unnest_tokens(sentence, text, token = "sentences")
191+
unnest_tokens(output = sentence, input = text, token = "sentences")
192192
```
193193

194194
Let's look at just one.

0 commit comments

Comments
 (0)