Learn R Programming

textrecipes (version 0.5.1)

show_tokens: Show token output of recipe

Description

Returns the tokens as a list of character vector of a recipe. This function can be useful for diagnostics doing recipe construction but should not be used in final recipe steps. Note that this function will both prep() and bake() the recipe it is used on.

Usage

show_tokens(rec, var, n = 6L)

Arguments

rec

A recipe object

var

name of variable

n

Number of elements to return.

Value

A list of character vectors

Examples

Run this code
# NOT RUN {
text_tibble <- tibble(text = c("This is words", "They are nice!"))

recipe(~text, data = text_tibble) %>%
  step_tokenize(text) %>%
  show_tokens(text)

library(modeldata)
data(tate_text)

recipe(~., data = tate_text) %>%
  step_tokenize(medium) %>%
  show_tokens(medium)
# }

Run the code above in your browser using DataLab