fwf2csv {descr} | R Documentation |
Convert fixed width formated file into a tab separated one.
fwf2csv(fwffile, csvfile, names, begin, end, verbose = getOption("verbose"))
fwffile |
The fixed width format file. |
csvfile |
The csv file to be created. The fields will be separated by tab characters and there will be no quotes around strings. |
names |
A character vector with column names. |
begin |
A numeric vector with the begin offset of values in the fixed width format file. |
end |
A numeric vector with the end offset of values in the fixed width format file. |
verbose |
Logical: if |
The return value is NULL, but cvsfile
is created if the function is
successful. The file is a text table with fields separated by tabular
characters without quotes around the strings. This function is useful if you
have a very big fixed width formated file to read and read.fwf
would be too slow.
NULL.
Jakson A. Aquino jalvesaq@gmail.com
## Not run: begin <- c(1, 3, 6, 9, 10, 11, 13) end <- c(2, 5, 8, 9, 10, 12, 16) names <- c("state", "municp", "house", "cond", "sex", "age", "income") fwf2csv("example.txt", "example.csv", names, begin, end) df <- read.table("example.csv", header = TRUE, sep = "\t", quote = "") ## End(Not run)