Description Usage Arguments Details Examples
Separate data set into multiple output files for each departing item
1 2 |
DT |
data.table. Data object containing multiple rows and columns. |
departingColumn |
string A single value which name of one of the columns in the data set. This will be used to separate data. |
outputDir |
string. Path to a directory to save the output. If it does not exist, it will be created. Data inside the directory will be overwritten without notice. |
writeWholeToo |
logical. If TRUE write whole data set into a file alongside the separated files. Default is TRUE. |
output.format |
string. Format of the output files. Default is CSV.
Possible values are |
... |
Dots. This is usually |
After separating data based on the given column, each part is written to a separate file in the given directory. If the directory does not exist, it will be created. If the directory exists and contains data, they will be overwritten without notice.
1 2 3 4 5 6 7 8 | {
input_file <- system.file("extdata", "input_file.csv", package = "KHanSUtils")
DT <- KH.loadCSV(input_file)
KH.depart(DT, 'origin', '/tmp/test-csv')
#[1] TRUE
KH.depart(DT, 'origin', '/tmp/test-xlsx', output.format = 'xlsx')
#[1] TRUE
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.