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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -