library(readr)
fwf_sample <- system.file("extdata/fwf-sample.txt", package = "readr")
cat(read_lines(fwf_sample))
# works
read_fwf(fwf_sample, fwf_widths(c(2, 5, 3)),col_types='ddd')
# includes a column of NAs because the column contains data even though it was told to skip?
read_fwf(fwf_sample, fwf_widths(c(2, 5, 3)),col_types='d-d')
The text was updated successfully, but these errors were encountered:
I ran into the same problem, getting parsing errors while trying to read selected fields from a large BRFSS survey data file. Took a couple of hours to realize what was happening. The help page for read_fwf now says "The width of the last column will be silently extended to the next line break" so R reads the entire remainder of the line following what's supposed to be the last field. I don't understand the rationale for this change; the old behavior needs to be restored or an argument added to say "I'm done, go to the next line."
sorry if i'm misreading something. thanks!
The text was updated successfully, but these errors were encountered: