On 26-Aug-03 Prof Brian Ripley wrote:
> On Tue, 26 Aug 2003 [EMAIL PROTECTED] wrote:
> [...]
>>   > X
>>   [1] "1,4,5" "1,2,5" "5,1,2"
>> 
>> Now my Question:
>> [...]
>> In other words, how to convert a vector of character strings, each
>> of which is in comma-separated format as above, into the rows of
>> a data-frame (or matrix, come to that)?
> 
> read.table() on a text connection.
> 
>> X <- c("1,4,5", "1,2,5", "5,1,2")
>> read.table(textConnection(X), header=FALSE, sep=",")
>   V1 V2 V3
> 1  1  4  5
> 2  1  2  5
> 3  5  1  2

Thanks, Brian! Just the job.
Best wishes,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 167 1972
Date: 26-Aug-03                                       Time: 10:05:14
------------------------------ XFMail ------------------------------

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to