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
Post a Comment