Skip to content
Prev 163828 / 398506 Next

Strplit code

Dear Wacek,

I've thought a bit more about this problem, and recall that I originally
wrote Strsplit() [and replacements for sub() and gsub(), which were not then
in S-PLUS] for the version of the car package that I released for S-PLUS,
because other functions in the package used these. The strings involved were
small, so performance issues weren't that important, although of course it's
better to have a more efficient solution.

Although I no longer have an installed copy of S-PLUS to confirm this, I
believe that gregexepr() is still not present in S-PLUS (though I think that
strsplit() is in the latest version). If that's the case, then your function
wouldn't work at all in the context of the original posting, which asked for
a solution in S-PLUS. You could make your code work in S-PLUS, and probably
still have it more efficient than mine, by writing a replacement for
gregexpr().
is
Indeed. Had I anticipated the possibility of multiple-character splits I
would have done so.

John