[S] delimiting strings

sinclair, andrew (asinclair@edfman.co.uk)
Wed, 21 Oct 1998 12:38:00 +0100


Dear Splus-ers,

I am in need of a function that reverses what paste() does.

e.g.
> tmp <- paste( c("Hello", "World", "!!", collapse = " " )
> tmp
"Hello World !!"

Now I would like to be able to do :

> delimit(tmp, sep=" ")
[1] "Hello" "World" "!!"

Surely this function already exists in Splus - I just don't know of it ??
Or maybe one of you smart guys can write a nice one-liner ?!

[ I've already thought of :
cat( tmp, file = "junk" )
scan( "junk", what = "", sep=" " )
unix( "rm junk" ) ### aplogies to Windows users
BUT it seems perverse and messy to have to write a file to
do such a simple operation...... ]

Andrew

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news