Re: [R] Converting strings with internal delimiters into lists

From: Berton Gunter <>
Date: Fri 12 Aug 2005 - 03:58:42 EST

??? I guess I don't get it.

Note that

> testtable<-
>"Joe,Mary,Jane","Mary"),c("Fred,Joe","Pete,Joe,Mary,Fr ed")))

is probably not what you want since cbind expects vectors of equal length. By default, shorter vectors are recycled to the length of the longest one, which I doubt is what you want.

Why isn't


mylist<-list(c("Joe,Mary,Jane","Mary"),c("Fred,Joe","Pete,Joe,Mary,Fred"),.. .)

suitable? S lists are specifically designed to handle different objects with different lengths (or totally different objects). lapply(), sapply() and friends or for() loops can then work over such a list to do what you want.

"The business of the statistician is to catalyze the scientific learning process." - George E. P. Box mailing list PLEASE do read the posting guide! Received on Fri Aug 12 04:04:35 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:15:07 EST