[Rd] read.fwf doesn't work with header = TRUE (PR#8226)

Emmanuel.Paradis@mpl.ird.fr Emmanuel.Paradis at mpl.ird.fr
Thu Oct 20 10:40:49 CEST 2005


Full_Name: Emmanuel Paradis
Version: 2.1.1
OS: Linux
Submission from: (NULL) (193.49.41.105)


read.fwf(..., header = TRUE) does not work properly since:

1/ the original header is printed on the console and not in FILE;
2/ the different 'parts' of the header should be separated with tabs
   to work with the call to read.table.

Here is a suggested fix for src/library/utils/R/read.fwf.R:

38c38,40
<         cat(FILE, headerline, "\n")
---
>         headerline <- unlist(strsplit(headerline, " {1,}"))
>         headerline <- paste(headerline, collapse = "\t")
>         cat(file = FILE, headerline, "\n")

PS: my R is not updated by read.fwf.R does not seem to have been changed in R
2.2.0.



More information about the R-devel mailing list