sort_files {forceR} | R Documentation |
Sorts files after corrections
Description
The files of each of the various possible correction steps (cropping, amplififer correction, drift correction)
are all located in their own folders. This function gets all files that represent the last correction step of a
given measurement out of all those folders and saves them in the results.folder
.
Usage
sort_files(data.folders, results.folder, move = FALSE)
Arguments
data.folders |
Character vector containing full folder paths of folders to check. This list must be sorted
according to the chronology of previous file editing. If a measurement exists in the last folder,
this is copied or moved into the |
results.folder |
Character string defining the full path to the folder where the desired files will be stored. |
move |
A logical value specifying if files should be moved ( |
Details
The function will look for leading numbers in the file names specifying the measurement number to find corresponding files in the different folders. E.g., it will identify "0001_ABCD.csv", "0001_ABCD_ampdriftcorr.csv", and "0001_ABCD_ampdriftcorr_baselincorr.csv" as stemming from the same measurement and sort them accordingly.
Value
This functions does not create new files but sorts existing files. It does, however, create the results.folder
in case it did not exist before.
Examples
# define data.folders
data.folders <- c("./raw",
"./cropped",
"./ampdriftcorr",
"./baselinecorr")
# define the folder in which one corrected file per original raw measurement
# should be stored.
results.folder <- "./corrected"
# run the file sorting - commented out to pass package tests
# sort_files(data.folders = data.folders,
# results.folder = results.folder,
# move = FALSE)