[R] R tools for large files
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Tue Aug 26 11:05:14 CEST 2003
On 26-Aug-03 Prof Brian Ripley wrote:
> On Tue, 26 Aug 2003 Ted.Harding at nessie.mcc.ac.uk 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) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 26-Aug-03 Time: 10:05:14
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list