View source: R/01-file_index.R
file_index_read | R Documentation |
Reads all files from a file index tibble as R objects to generate in the environment or R scripts to be sourced. Any other file types will be opened in browser (html files) or in environment. If no index tibble is provided, the function creates one from the working directory. (matching by regex is supported).
file_index_read(
index,
file_path = "^",
file_name = "^",
extension = "^",
file_type = "^",
assign = FALSE,
.envir = parent.frame()
)
index |
The index (tibble) of a folder with file locations and metadata, either previously generated by file_index_create() or created from folder. |
file_path |
A character string specifying a file path to search by. Can be the full string or substring (matching by regex is supported) |
file_name |
A character string a file name to search by. Can be the full string or substring (matching by regex is supported). |
extension |
A character string a file extension to search by. Can be the full string or substring (matching by regex is supported). |
file_type |
A character string a file type to search by. Can be the full string or substring (matching by regex is supported). |
assign |
If TRUE, the name is automatically assigned from the name of the object read. |
.envir |
The environment to use. parent.frame() by default |
for each file selected,
xlsx files will be read using the function read_excel_allsheets()
,
csv files will be read using the function read_csv_any_formats()
,
spss and sav files will be read using the function haven::read_spss()
,
dta files will be read using the function haven::read_dta()
,
sas7bdat and sas files will be read using the function haven::read_sas()
,
R scripts, Rmd and md files be read using the function readLines()
,
The whole files will be created in a list, which name is the name of the
file.
R objects generated in the environment or R scripts. R object names are created automatically from their file names. Otherwise return messages indicating what objects were created, or files opened, and if any troubles occurred.
read_excel_allsheets()
, read_csv_any_formats()
, haven::read_spss()
,
haven::read_dta()
, haven::read_sas()
, readLines()
## Not run:
index <- file_index_create(tempdir())
file_index_read(index, file_name = my_file_name)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.