rbindFiles(infiles, outfile, col.sep, header = FALSE, ask = TRUE,
verbose = FALSE, add.file.number = FALSE, blank.lines.skip = FALSE)
col.sep = "[[:space:]]"
or col.sep = "[[:blank:]]"
.outfile
will display this header in its first row, assuming the headers for each file are identical. Equals FALSE by default, i.e. no headers assumed.lineByLine
ignores blank lines in the input.rbindFiles
is to produce outfile
.rbind
combines R objects by rows. However, reading large data files may require a large amount of memory and be extremely time consuming.
rbindFiles
avoids reading the full files into memory. It reads the files line by line, possibly modifies each line, then writes to outfile.
If however, header
, verbose
, add.file.number
and blank.lines.skip
are all set to "FALSE"
(their default values), the files are appended directly, thus evading line-by-line modifications.
In the case where infiles
contains only one file and no output or modifications are requested
(verbose
, add.file.number
and blank.lines.skip
equal "FALSE"), an identical copy of this file is made.
cbindFiles
, lineByLine
## Not run:
#
# # Combines the three infiles, by rows
# rbindFiles(file.names = c("myfile1.txt", "myfile2.txt", "myfile3.txt"),
# outfile = "myfile_combined_by_rows.txt", col.sep = " ", header = TRUE, verbose = TRUE)
#
# ## End(Not run)
Run the code above in your browser using DataLab