bb_modify_source | R Documentation |
This is a helper function designed to make it easier to modify an already-defined data source. Generally, parameters passed here will replace existing entries in src
if they exist, or will be added if not. The method
and postprocess
parameters are slightly different: see Details, below.
bb_modify_source(src, ...)
src |
data.frame or tibble: a single-row data source (as returned by |
... |
: parameters as for |
With the exception of the method
and postprocess
parameters, any parameter provided here will entirely replace its equivalent in the src
object. Pass a new value of NULL
to remove an existing parameter.
The method
and postprocess
parameters are lists, and modification for these takes place at the list-element level: any element of the new list will replace its equivalent element in the list in src. If the src list does not contain that element, it will be added. To illustrate, say that we have created a data source with:
src <- bb_source(method=list("bb_handler_rget", parm1 = value1, parm2 = value2), ...)
Calling
bb_modify_source(src, method = list(parm1 = newvalue1))
will result in a new method
value of list("bb_handler_rget", parm1 = newvalue1, parm2 = value2)
Modifying postprocess
elements is similar. Note that it is not currently possible to entirely remove a postprocess component using this function. If you need to do so, you'll need to do it manually.
as for bb_source
: a tibble with columns as per the bb_source
function arguments (excluding warn_empty_auth
)
bb_source
## this pre-defined source requires a username and password
src <- bb_example_sources(
"Sea Ice Trends and Climatologies from SMMR and SSM/I-SSMIS, Version 3")
## add username and password
src <- bb_modify_source(src,user="myusername",password="mypassword")
## or using the pipe operator
src <- bb_example_sources(
"Sea Ice Trends and Climatologies from SMMR and SSM/I-SSMIS, Version 3") %>%
bb_modify_source(user="myusername",password="mypassword")
## remove the existing "data_group" component
src %>% bb_modify_source(data_group=NULL)
## change just the 'level' setting of an existing method definition
src %>% bb_modify_source(method=list(level=3))
## remove the 'level' component of an existing method definition
src %>% bb_modify_source(method=list(level=NULL))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.