EVOLUTION-MANAGER
Edit File: strcapture.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: Capture String Tokens into a data.frame</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 strcapture {utils}"><tr><td>strcapture {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Capture String Tokens into a data.frame</h2> <h3>Description</h3> <p>Given a character vector and a regular expression containing capture expressions, <code>strcapture</code> will extract the captured tokens into a tabular data structure, such as a data.frame, the type and structure of which is specified by a prototype object. The assumption is that the same number of tokens are captured from every input string. </p> <h3>Usage</h3> <pre> strcapture(pattern, x, proto, perl = FALSE, useBytes = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>pattern</code></td> <td> <p>The regular expression with the capture expressions. </p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>A character vector in which to capture the tokens. </p> </td></tr> <tr valign="top"><td><code>proto</code></td> <td> <p>A <code>data.frame</code> or S4 object that behaves like one. See details. </p> </td></tr> <tr valign="top"><td><code>perl,useBytes</code></td> <td> <p>Arguments passed to <code><a href="../../base/html/grep.html">regexec</a></code>. </p> </td></tr> </table> <h3>Details</h3> <p>The <code>proto</code> argument is typically a <code>data.frame</code>, with a column corresponding to each capture expression, in order. The captured character vector is coerced to the type of the column, and the column names are carried over to the return value. Any data in the prototype are ignored. See the examples. </p> <h3>Value</h3> <p>A tabular data structure of the same type as <code>proto</code>, so typically a <code>data.frame</code>, containing a column for each capture expression. The column types and names are inherited from <code>proto</code>. Cases in <code>x</code> that do not match <code>pattern</code> have <code>NA</code> in every column. </p> <h3>See Also</h3> <p><code><a href="../../base/html/grep.html">regexec</a></code> and <code><a href="../../base/html/regmatches.html">regmatches</a></code> for related low-level utilities. </p> <h3>Examples</h3> <pre> x <- "chr1:1-1000" pattern <- "(.*?):([[:digit:]]+)-([[:digit:]]+)" proto <- data.frame(chr=character(), start=integer(), end=integer()) strcapture(pattern, x, proto) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>