Skip to content
Prev 277289 / 398506 Next

Help with text separation

Hi,

On Mon, Nov 14, 2011 at 4:20 AM, Michael Griffiths
<griffiths at upstreamsystems.com> wrote:
You just want to get rid of them? gsub() it is.

I've changed your formula a little bit to better demonstrate what's going on:
[1] "~ A + C / D + E + E / F * G + H + I + J + K"

That regular expression will take out a
space
+
any capital letter
space
*
space
any capital letter.

It will take out all occurrences of that sequence, but won't take out
occurrences of * not in that sequence.

If you don't want the spaces, you don't need them. Just take them out
of the regular expression as well.

Not that strsplit() was remotely the right tool here, but you can
split into characters without a separator:
[[1]]
[1] "a" "b" "c" "d"

Sarah