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

sql - VB.NET Operand type clash: date is incompatible with int error -

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

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -