View source: R/datacommons_map_files.R
datacommons_map_files | R Documentation |
Extract variables and IDs from files in datacommons repositories
datacommons_map_files(dir, search_pattern = "\\.csv(?:\\.[gbx]z2?)?$",
variable_location = "measure", id_location = "geoid",
reader = read.csv, overwrite = FALSE, verbose = TRUE)
dir |
Directory of the data commons projects. |
search_pattern |
A regular expression string used be passed to |
variable_location |
The name of a column contain variable names in each dataset, or a function to retrieve
variable names (e.g., |
id_location |
The name of a column contain IDs in each dataset, or a function to retrieve
IDs (e.g., |
reader |
A function capable of handling a connection in its first argument, which returns a matrix-like object. |
overwrite |
Logical; if |
verbose |
Logical; if |
An invisible list
, including a data.frame
of the mapped variables, with variable
(variable name),
repo
(the repository containing the file), dir_name
(variable name with a prefix from the parent directories),
full_name
(variable name with a prefix from the last part of the file's name, after a year or year range),
and file
(path to the file) columns, and a list
of the mapped IDs, with an entry for each ID,
each of which with entries for repos
(repositories in which the ID appears) and files
(files in which the ID appears).
## Not run:
# from a data commons project directory
map <- datacommons_map_files(".")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.