src_argos sets up a dplyr or DBI data source
using information from a JSON configuration file, and returns
the data source.
A vector of file names to use in searching for configuration
A vector of directory names to use in searching for configuration
A vector of full path names for the configuration file. If present,
A list containg the configuration data, to be used instead of reading a configuration file, should you wish to skip that step.
The configuration file must provide all of the information
necessary to set up the
src or DBI
connection. Given the variety of ways a data source can be
specified, the JSON must be a two-element hash. The
src_name key points to a string containing name of a
dplyr function that sets up the data source
src_postgres), or of a DBI driver
SQLite), as one might pass to
dbDriver. If the
src_name begins with
src_, it is taken as the former, otherwise it is taken as
the latter. In this case, an attempt will be made to load an
appropriate DBI library if the driver function is not found.
src_args key points to a nested hash, whose keys are the
arguments to that function, and whose values are the argument
paths is present, only the specified paths are checked.
find_config_files is called to locate
candidate configuration files, using
basenames, if present. The first file that exists, is
readable, and evaluates as legal JSON is used as the source of
src object. The specific class of the object
is determined by the
src_name in the configuration data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Not run: # Search all the (filename-based) defaults src_argos() # "The usual" src_argos('myproj_prod') # Look around src_argos( dirs = c(Sys.getenv('PROJ_CONF_DIR'), 'var/lib', getwd()), basenames = c('myproj', Sys.getenv('PROJ_NAME')) ) # No defaults src_argos(paths = c('/path/to/known/config.json')) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.