file_merge: Vertically Merge Files in a Directory into a Single Large...

Description Usage Arguments Value

Description

Vertically concatenates files containing data tables in a long format into a single large dataset. In order for the function to work, all files you wish to merge should be in the same format (either txt or csv). This function is very useful for concatenating raw data files of individual subjects in an experiment (in which each line corresponds to a single observation in the experiment) to one raw data file that includes all subjects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
file_merge(
           folder_path = NULL
           , has_header = TRUE
           , new_header = c()
           , raw_file_name = NULL
           , raw_file_extension = NULL
           , file_name = "dataset.txt"
           , save_table = TRUE
           , dir_save_table = NULL
           , notification = TRUE
          )

Arguments

folder_path

A string with the path of the folder in which files to be merged are searched. Search is recursive (i.e., can search also in subdirectories). folder_path must be provided. Default is NULL.

has_header

Logical. If TRUE, the function takes the first line of the first file found as the header of the merged table. Default is TRUE.

new_header

String vector with names for columns of the merged table. Default is c(). If used, new_header should be the same length as the number of columns in the merged table.

raw_file_name

A string with the name of the files to be searched and then merged. File extension should NOT be included here (see raw_file_extension). raw_file_name must be provided. Default is NULL.

raw_file_extension

A string with the format of the files (i.e., csv or txt) to be merged. raw_file_extension must be provided. Default is NULL.

file_name

A string with the name of the file of the merged table the function creates in case save_table is TRUE. Extension of the the file can be txt or csv and should be included. Default is "dataset.txt".

save_table

Logical. If TRUE, saves the merged table. Default is TRUE.

dir_save_table

A string with the path of the folder in which the merged table is saved in case save_table is TRUE. Default is the path provided in folder_path.

notification

Logical. If TRUE, prints messages about the progress of the function. Default is TRUE.

Value

The merged table


ayalaallon/prepdat documentation built on May 11, 2019, 4:12 p.m.