EVOLUTION-MANAGER
Edit File: unnest_regex.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Wrapper around unnest_tokens for regular expressions</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for unnest_regex {tidytext}"><tr><td>unnest_regex {tidytext}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Wrapper around unnest_tokens for regular expressions</h2> <h3>Description</h3> <p>This function is a wrapper around <code>unnest_tokens( token = "regex" )</code>. </p> <h3>Usage</h3> <pre> unnest_regex( tbl, output, input, pattern = "\\s+", format = c("text", "man", "latex", "html", "xml"), to_lower = TRUE, drop = TRUE, collapse = NULL, ... ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>tbl</code></td> <td> <p>A data frame</p> </td></tr> <tr valign="top"><td><code>output</code></td> <td> <p>Output column to be created as string or symbol.</p> </td></tr> <tr valign="top"><td><code>input</code></td> <td> <p>Input column that gets split as string or symbol. </p> <p>The output/input arguments are passed by expression and support <a href="../../rlang/html/quasiquotation.html">quasiquotation</a>; you can unquote strings and symbols.</p> </td></tr> <tr valign="top"><td><code>pattern</code></td> <td> <p>A regular expression that defines the split.</p> </td></tr> <tr valign="top"><td><code>format</code></td> <td> <p>Either "text", "man", "latex", "html", or "xml". When the format is "text", this function uses the tokenizers package. If not "text", this uses the hunspell tokenizer, and can tokenize only by "word"</p> </td></tr> <tr valign="top"><td><code>to_lower</code></td> <td> <p>Whether to convert tokens to lowercase. If tokens include URLS (such as with <code>token = "tweets"</code>), such converted URLs may no longer be correct.</p> </td></tr> <tr valign="top"><td><code>drop</code></td> <td> <p>Whether original input column should get dropped. Ignored if the original input and new output column have the same name.</p> </td></tr> <tr valign="top"><td><code>collapse</code></td> <td> <p>A character vector of variables to collapse text across, or <code>NULL</code>. </p> <p>For tokens like n-grams or sentences, text can be collapsed across rows within variables specified by <code>collapse</code> before tokenization. At tidytext 0.2.7, the default behavior for <code>collapse = NULL</code> changed to be more consistent. The new behavior is that text is <em>not</em> collapsed for <code>NULL</code>. </p> <p>Grouping data specifies variables to collapse across in the same way as <code>collapse</code> but you <strong>cannot</strong> use both the <code>collapse</code> argument and grouped data. Collapsing applies mostly to <code>token</code> options of "ngrams", "skip_ngrams", "sentences", "lines", "paragraphs", or "regex".</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Extra arguments passed on to <a href="../../tokenizers/html/tokenizers.html">tokenizers</a></p> </td></tr> </table> <h3>See Also</h3> <ul> <li> <p><code><a href="unnest_tokens.html">unnest_tokens()</a></code> </p> </li></ul> <h3>Examples</h3> <pre> library(dplyr) library(janeaustenr) d <- tibble(txt = prideprejudice) d %>% unnest_regex(word, txt, pattern = "Chapter [\\\\d]") </pre> <hr /><div style="text-align: center;">[Package <em>tidytext</em> version 0.3.4 <a href="00Index.html">Index</a>]</div> </body></html>