Description Usage Arguments Details Value Examples
src_argos
sets up a dplyr or DBI data source
using information from a JSON configuration file, and returns
the data source.
1 |
basenames |
A vector of file names to use in searching for configuration
file, if |
dirs |
A vector of directory names to use in searching for configuration
files, if |
paths |
A vector of full path names for the configuration file. If present,
only |
config |
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
(e.g. src_postgres
), or of a DBI driver
method (e.g. 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.
The src_args
key points to a nested hash, whose keys are the
arguments to that function, and whose values are the argument
values.
If paths
is present, only the specified paths are checked.
Otherwise, find_config_files
is called to locate
candidate configuration files, using dirs
and
basenames
, if present. The first file that exists, is
readable, and evaluates as legal JSON is used as the source of
configuration data.
A 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.