[R] separate commands by semicolon
wdunlap at tibco.com
Thu Sep 15 21:28:05 CEST 2016
The most reliable way to split such lines is with parse(text=x).
Regular expressions don't do well with context-free grammars.
On Thu, Sep 15, 2016 at 12:08 PM, Adrian Dușa <dusa.adrian at unibuc.ro> wrote:
> Dear R-helpers,
> When parsing a text, I would like to separate commands written on the same
> line, by a semicolon.
> Something like:
> x <- "foo <- '3;4'; bar <- \"don't ; use semicolons\""
> Ideally, that would translate to these two commands in a character vector
> of length 2:
> foo <- '3;4'
> bar <- "don't ; use semicolons"
> It's probably a regexp magic, but I just can't find it.
> Any hint is highly appreciated,
> Adrian Dusa
> University of Bucharest
> Romanian Social Data Archive
> Soseaua Panduri nr.90
> 050663 Bucharest sector 5
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help