Description Usage Arguments Examples
Util function to merge multiple table files.
1 2 3 4 5 6 7 | merge_table_files(input_files = NULL, files_dir = NULL,
pattern = ".*.txt", outfn = NULL, add.filename = TRUE,
read_fun = "read.table", read_params_file = "file",
read_params = list(sep = "\t", header = TRUE),
write_fun = "write.table", write_params_x = "x",
write_params_file = "file", write_params = list(sep = "\t",
row.names = FALSE), op = list(stringsAsFactors = FALSE))
|
input_files |
Basename of files that need to be merged, default is NULL and use the regular expression pattern to select files |
files_dir |
Directory name of input files |
pattern |
Use regular expression to select files in files_dir |
outfn |
Output file path, default is NULL and return the data.frame object |
add.filename |
Wheather to add the merged filename, default is TRUE |
read_fun |
Function to read data, default is read.table |
read_params_file |
Parameter name of input file in read_fun |
read_params |
Other parameters pass to read_fun |
write_fun |
Function to read data, default is read.table |
write_params_x |
Parameter name of output object in read.fun |
write_params_file |
Parameter name of input file in read.fun |
write_params |
Other parameters pass to write_fun |
op, |
Extra option that only take effect in merge process |
1 2 3 4 5 6 7 8 9 10 | a <- data.frame(col1=1:6, col2=2:7)
b <- data.frame(col1=6:11, col2=1:6)
file_a <- paste0(tempfile(), '_abcd')
file_b <- paste0(tempfile(), '_abcd')
write.table(a, file_a, sep = '\t', row.names = FALSE)
write.table(b, file_b, sep = '\t', row.names = FALSE)
input_files <- c(file_a, file_b)
x1 <- merge_table_files(input_files = input_files)
x2 <- merge_table_files(files_dir = tempdir(), pattern = '.*_abcd$')
outfn = tempfile()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.