[R] read.fwf and header
    Gregor Gorjanc 
    gregor.gorjanc at bfro.uni-lj.si
       
    Wed Nov  1 22:31:54 CET 2006
    
    
  
Greg Snow wrote:
> How about using a connection and reading the header separate from the
> data, like this:
> 
> tmp1 <- file('c:/temp/tmp.dat')
> open(tmp1)
> 
> my.names <- scan(tmp1, nlines=1, what='')
> 
> 
> new.data<-read.fwf(file=tmp1, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19),
> header=FALSE)
> 
> names(new.data) <- my.names
> 
> close(tmp1)
Yes, also possible as has been shown in previous posts.
-- 
Lep pozdrav / With regards,
    Gregor Gorjanc
----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si
SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888
----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.
    
    
More information about the R-help
mailing list