strsplit by spaces greater than one in R -


given string,

mystr = "average student score       88" 

i wish split if there more 1 space. wish obtain following:

"average student score" "88" 

i searched "\s+" split number of spaces.

strsplit(mystr, "\\s+") 

but not want. there option within strsplit can split strings based on number of spaces (say space = k) or rule on spaces (say space > 1)?

you may specify through repetition quantifier.

strsplit(mystr, "\\s{2,}") 

\\s{2,} regex should match 2 or more spaces.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -