[R] read.table with data in specific formats
Xiao Liu
xiaoliu2 at stanford.edu
Fri May 19 06:40:13 CEST 2006
"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 at 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 at 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)
More information about the R-help
mailing list