Re: [R] options other than regex

2018-05-25 Thread Alex Zarebski
The stringr package might beof interest to you (and I think magrittr makes it more readable). > library(stringr) > library(magrittr) > '10110111' %>% str_split('') %>% unlist %>% str_flatten('.') [1] "1.0.1.1.0.1.1.1" Note that the unlist is there because we are only applying this to a single str

Re: [R] options other than regex

2018-05-25 Thread Greg Minshall
Evan, are you really looking at numbers, or just at character strings (that, in your case, happen to be numbers)? if just characters, this rather odd combination of strsplit() and Reduce() might do the trick: > x <- '10110111' > print(x) [1] "10110111" > y <- Reduce(function (x,y) { paste(x,

Re: [R] options other than regex

2018-05-25 Thread Evan Cooch
Numbers -- thanks. Another clever trick. On 5/25/2018 11:54 AM, Greg Minshall wrote: > Evan, > > are you really looking at numbers, or just at character strings (that, > in your case, happen to be numbers)? if just characters, this rather > odd combination of strsplit() and Reduce() might do the

Re: [R] options other than regex

2018-05-25 Thread Evan Cooch
ení odpovědnosti: > https://www.precheza.cz/01-dovetek/ | This email and any documents attached > to it may be confidential and are subject to the legally binding disclaimer: > https://www.precheza.cz/en/01-disclaimer/ > >> -Original Message- >> From: R-help [mailt

Re: [R] options other than regex

2018-05-25 Thread PIKAL Petr
are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/ > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch > Sent: Friday, May 25, 2018 3:43 PM > To: R-help > Subject: [R] options other tha

[R] options other than regex

2018-05-25 Thread Evan Cooch
Hi -- I'm looking for alternatives to regex for a fairly simply 'reformatting' problem. Alternatives only because a lot of folks have trouble parsing/interpreting regex expressions, and I'm looking for suggestions for something more 'transparent'. Here is an example of what I'm trying to do.