[R] splitting a string into words preserving blanks (using regex)
Mark Heckmann
mark.heckmann at gmx.de
Mon Oct 24 15:46:24 CEST 2011
I would like to split a string into words at its blanks but also to preserve all blanks.
Example:
c(" some words to split ")
should become
c(" ", "some", " ", " words", " ", "to" , " ", "split", " ")
I was not able to achieve this via strsplit() .
But I am not familiar with regular expressions.
Is there an easy way to do that using e.g. regex and strsplit?
Thanks
Mark
–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com
More information about the R-help
mailing list