rbinder | R Documentation |
Batch read and unite multiple data files into a single data.frame
.
rbinder(
file.pattern,
readf = read.csv2,
path = ".",
unique.field.name,
result = c("default", "summary", "debug"),
...
)
file.pattern |
character; specifies regex pattern of file names to be processed. |
readf |
function; specifies function (which has to return a |
path |
character; specifies directory from which to collect files corresponding to |
unique.field.name |
character; column names designating unique entries that are not to be duplicated after uniting of files; use to avoid duplicates introduced by reading in of files with same content. |
result |
character; increases verbosity ("summary") or additionally persists intermediary results to file |
... |
arguments passed to function |
a united data.frame
with unique entries not duplicated despite possible multiple occurrence in files
df_pattern_subset()
for subsetting a data.frame
, useful for creating custom readers, see examples
# - Folder 'extdata' (system.file("extdata", package = "kungfu") contains three csv-files:
#> dir(system.file("extdata", package = "kungfu"), pattern = "csv")
#[1] "data01.csv" "data02.csv" "data03.csv"
#
# - To join them, run:
data_combined <- rbinder("^data", read.csv, path = system.file("extdata", package = "kungfu"), unique.field.name = "id")
#
# - You can also create your own custom "dirty reader" and supply that to "rbinder"
# - (Please see "?df_pattern_subset" for information regarding that function)
# - e.g.:
# my_dirty_excel_reader <- function(path) {
# read_xlsx(path) %>%
# df_pattern_subset("^mySpecial.*Pattern$", ignore_columns = TRUE) %>%
# select(id, size, -timestamp, etc, anothercolumn)
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.