Learn R Programming

filesstrings (version 1.1.0)

merge_tables_on_disk: Merge tables on disk.

Description

Merge tables saved on disk as delimited files. The merging is done lengthways so they need to have the same number of columns and the same column names (if they have column names).

Usage

merge_tables_on_disk(files, delim, out_name, header = TRUE, ...)

Arguments

files

The paths to the files to merge.

delim

Delimeter used to separate values.

out_name

The path to the output file containing the merged tables.

header

Do the tables to be merged have headers?

...

Additional arguments passed to readr::read_delim.

Examples

Run this code
# NOT RUN {
setwd(tempdir())
dir.create("MergeTablesOnDisk_test")
setwd("MergeTablesOnDisk_test")
tab1 <- tibble::tibble(x = 1, y = 2)
tab2 <- tibble::tibble(x = 1, y = 29)
mapply(readr::write_csv, list(tab1, tab2), paste0(c("tab1", "tab2"), ".csv"))
merge_tables_on_disk(c("tab1.csv", "tab2.csv"), ",", "merged.csv")
readr::read_csv("merged.csv")
setwd("..")
dir.remove("MergeTablesOnDisk_test")
# }

Run the code above in your browser using DataLab