re: [S] delimiting strings

Wed, 21 Oct 1998 14:35:17 +0200

On Wed Oct 21 12:38:00 1998,
"sinclair, andrew (MIP London)" <> wrote:
>I am in need of a function that reverses what paste() does.
>> 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 ?!


In S-PLUS 3.3 for Windoze, you can use this handy one-liner:

> unlist(unpaste("Hello World !!", sep = " "))
[1] "Hello" "World" "!!"

I assume unpaste() still is available in 4.0 and 4.5, I don't recall if it is
in UNIX versions. It does not, however, seem to be documented anywhere! Thus
if you plan to use it in a function for general consumption, you probably
should include a copy so it is guaranteed to be available.

You could have found this function with, e.g.

> lapply(search(), objects, pat = "*paste*"),

assuming, of course, you had guessed that "paste" was in the function name.


Wageningen Agricultural University
Laboratory of Plant Breeding
P.O. Box 386
6700 AJ Wageningen
This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news