[R] Read.fwf
    Uwe Ligges 
    ligges at statistik.uni-dortmund.de
       
    Wed Sep 15 15:11:21 CEST 2004
    
    
  
Doran, Harold wrote:
> Dear List
> 
> I have a fixed width file with variables of varying width. The help is
> pretty transparent for this feature, but I can't seem to figure out how
> I can make effective use of the package with my data.
> 
> In my dataset, the first 80 columns are of width 1 followed by other
> variables with width larger than 1.
> 
> I think the correct way to do this, by brute force, would be
> 
> 
>>read.fwf(dataset, 1,1,1,...,1,5,...).
> 
> 
> I'm sure I do not need to actually enter 80 "1"s, correct? How might I
> do this more effectively?
?read.fwf:
"widths  integer vector, giving the widths of the fixed-width fields (of 
one line)."
Hence:
read.fwf(dataset, c(rep(1, 80), 5, ...))
Uwe Ligges
> Harold
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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
    
    
More information about the R-help
mailing list