EVOLUTION-MANAGER
Edit File: split_lines.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: Split a character vector by line breaks</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 split_lines {xfun}"><tr><td>split_lines {xfun}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Split a character vector by line breaks</h2> <h3>Description</h3> <p>Call <code>unlist(strsplit(x, '\n'))</code> on the character vector <code>x</code> and make sure it works in a few edge cases: <code>split_lines('')</code> returns <code>''</code> instead of <code>character(0)</code> (which is the returned value of <code>strsplit('', '\n')</code>); <code>split_lines('a\n')</code> returns <code>c('a', '')</code> instead of <code>c('a')</code> (which is the returned value of <code>strsplit('a\n', '\n')</code>. </p> <h3>Usage</h3> <pre> split_lines(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A character vector.</p> </td></tr> </table> <h3>Value</h3> <p>All elements of the character vector are split by <code>'\n'</code> into lines. </p> <h3>Examples</h3> <pre> xfun::split_lines(c("a", "b\nc")) </pre> <hr /><div style="text-align: center;">[Package <em>xfun</em> version 0.16 <a href="00Index.html">Index</a>]</div> </body></html>