EVOLUTION-MANAGER
Edit File: invert_match.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: Switch location of matches to location of non-matches.</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 invert_match {stringr}"><tr><td>invert_match {stringr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Switch location of matches to location of non-matches.</h2> <h3>Description</h3> <p>Invert a matrix of match locations to match the opposite of what was previously matched. </p> <h3>Usage</h3> <pre> invert_match(loc) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>loc</code></td> <td> <p>matrix of match locations, as from <code><a href="str_locate.html">str_locate_all()</a></code></p> </td></tr> </table> <h3>Value</h3> <p>numeric match giving locations of non-matches </p> <h3>Examples</h3> <pre> numbers <- "1 and 2 and 4 and 456" num_loc <- str_locate_all(numbers, "[0-9]+")[[1]] str_sub(numbers, num_loc[, "start"], num_loc[, "end"]) text_loc <- invert_match(num_loc) str_sub(numbers, text_loc[, "start"], text_loc[, "end"]) </pre> <hr /><div style="text-align: center;">[Package <em>stringr</em> version 1.4.0 <a href="00Index.html">Index</a>]</div> </body></html>