Re: [R] read.table with data in specific formats

From: Xiao Liu <xiaoliu2_at_stanford.edu>
Date: Fri 19 May 2006 - 14:40:13 EST


"read.table" segments rows by separators, not by format of entry.

Suppose your "data.txt" is like:

1.00 2.01 3.003
4.10 5.22 6.333
7.22 8.88 9.99

Then
> read.table("data.txt", sep = " ")

Best Regards
XiaoQuoting YIHSU CHEN <yschen@jhu.edu>:

> Dear R Users
>
> Does anyone know how to read a text with a specific format? I know
> that has to do with two functions: read.table and sprintf but not sure
> how to put them together. Say that I have a text file called
> "data.txt", and I would to read it according with "%.14f %.10f %2.5f",
> which includes three columns.
>
> Thank you very much.
>
>
> Yihsu Chen
> The Johns Hopkins University
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



Xiao Liu
Stanford University Medical Center
Department of Developmental Biology
279 Campus Drive
Stanford, CA 94305-5329
(650)725-7612(L)

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 19 14:47:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 May 2006 - 16:10:22 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.