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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -