[R] Help with read.fwf

Vadlamani, Satish {FLNA} SATISH.VADLAMANI at fritolay.com
Wed Oct 28 22:02:00 CET 2009


Hi All:
I am trying to use read.fwf and encountering the following error below. Any ideas on what I can do?
I tried to use read.table (and the default for read.table is space) and it works. I am not sure why read.fwf is not working

 test_data_frame = read.fwf(file="small.txt",widths=width_vec,header=FALSE)
Error in file(FILENAME, "a") : cannot open the connection
In addition: Warning message:
In file(FILENAME, "a") :
  cannot open file 'C:\temp\RtmpLN6W00\Rfwf.2ea6bb3': No such file or directory
>

**** code below

setwd("d:/edump_data/11x4_2009")
current = as.Date("2009/10/25")
current = chron("10/25/2009", format="m/d/y")
next_date = current + 7
prev_date = current - 7
last_date = current - 7*156
#156 buckets in the past, one current bucket and 52 future buckets. Total is 209 buckets
future_dates = seq.dates(next_date,by='weeks',length=52)
past_dates = seq.dates(last_date,by='weeks',length=156)
num_buckets = rep(14,209)
width_vec = c(62,num_buckets)
test_data_frame = read.fwf(file="small.txt",widths=width_vec,header=false)




More information about the R-help mailing list