View source: R/e_read_data_subdir_into_lists.R
e_read_data_subdir_into_lists | R Documentation |
Recurse through subdirectories returning either filenames or tibbles (data.frames) by reading csv, xls, or xlsx with e_read_data_files()
.
e_read_data_subdir_into_lists(
fn_path = ".",
fn_detect = c("csv$", "xls$", "xlsx$"),
sw_fn_or_dat = c("fn", "dat")[1],
sw_exclude_empty_dir = c(TRUE, FALSE)[1],
sw_dat_add_col_path_fn = c(TRUE, FALSE)[1],
sw_dat_print_fn_read = c(TRUE, FALSE)[2],
excel_sheets = "all",
sw_clean_names = c(TRUE, FALSE)[2],
sw_list_or_flat = c("list", "flat")[1],
excel_range = NULL,
excel_col_names = TRUE,
sw_delim = c(FALSE, "|")[1],
sw_read_package_csv_txt = c("readr", "utils")[1]
)
fn_path |
Starting directory path |
fn_detect |
NULL for all. File specification, used by |
sw_fn_or_dat |
Return filenames or tibbles (data.frames) |
sw_exclude_empty_dir |
T/F exclude empty directories |
sw_dat_add_col_path_fn |
T/F for data, add two columns specifying the directory ( |
sw_dat_print_fn_read |
T/F print file names and dimensions as the files are read |
excel_sheets |
"all" for all sheets, or a list of numbers " |
sw_clean_names |
For data, T/F to clean column names using |
sw_list_or_flat |
Hierarical list or a "flat" 1-level list (if "fn" with "flat", then will prepend path to fn) |
excel_range |
When reading Excel files, NULL reads entire sheet, a range is specified as in |
excel_col_names |
Specified as in |
sw_delim |
F if standard delim, otherwise delim character such as "|" |
sw_read_package_csv_txt |
"readr" for |
fn_names Either a structured list of filenames or of tibbles
## Not run:
# # all file names
# e_read_data_subdir_into_lists(
# fn_path = "./data-raw/dat_subdir"
# , fn_detect = NULL
# , sw_fn_or_dat = c("fn", "dat")[1]
# , sw_exclude_empty_dir = c(TRUE, FALSE)[1]
# )
# # selected file names
# e_read_data_subdir_into_lists(
# fn_path = "./data-raw/dat_subdir"
# , fn_detect = c("csv$", "xls$", "xlsx$")
# , sw_fn_or_dat = c("fn", "dat")[1]
# , sw_exclude_empty_dir = c(TRUE, FALSE)[1]
# )
# # selected data
# e_read_data_subdir_into_lists(
# fn_path = "./data-raw/dat_subdir"
# , fn_detect = c("csv$", "xls$", "xlsx$")
# , sw_fn_or_dat = c("fn", "dat")[2]
# , sw_exclude_empty_dir = c(TRUE, FALSE)[1]
# , sw_dat_add_col_path_fn = c(TRUE, FALSE)[1]
# , sw_dat_print_fn_read = c(TRUE, FALSE)[1]
# , sw_clean_names = c(TRUE, FALSE)[2]
# , sw_list_or_flat = c("list", "flat")[1]
# , sw_delim = c(FALSE, "|")[1]
# , sw_read_package_csv_txt = c("readr", "utils")[1]
# )
# # selected data, flatten the directory structure
# e_read_data_subdir_into_lists(
# fn_path = "./data-raw/dat_subdir"
# , fn_detect = c("csv$", "xls$", "xlsx$")
# , sw_fn_or_dat = c("fn", "dat")[2]
# , sw_exclude_empty_dir = c(TRUE, FALSE)[1]
# , sw_dat_add_col_path_fn = c(TRUE, FALSE)[1]
# , sw_dat_print_fn_read = c(TRUE, FALSE)[1]
# , sw_clean_names = c(TRUE, FALSE)[2]
# , sw_list_or_flat = c("list", "flat")[2]
# , sw_delim = c(FALSE, "|")[1]
# , sw_read_package_csv_txt = c("readr", "utils")[1]
# )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.