Currently the catalogueExport function uses the built-in R function missing() to check for non-default function arguments:
if (!missing(analysisIds)) {
This is in contrast to checking the argument's value:
This makes life a bit harder for code that calls catalogueExport because you can't do something like this:
config <- loadConfig()
catalogueExport(
config$connectionDetails,
cdmDatabaseSchema = config$cdmSchema,
analysisIds = config$analysisIds
)
...because no possible value of config$analysisIds can specify that you want the default behavior (where no analysisIds argument was specified).
I've tried using substitute() to make an argument appear to be missing, but then that masks the default value of analysisIds from the catalogueExport function definition.
I can use conditionals to build up a list of function arguments and pass that via do.call but that makes the code a bit less clear and it fixes my problem but leaves it for other people.
How would you feel about a PR that replaces missing() checks with value checks?
The current uses of missing():
|
if (missing(cdmVersion)) { |
|
if (missing(sourceName) & !sqlOnly) { |
|
if (!missing(analysisIds)) { |
Currently the
catalogueExportfunction uses the built-in R functionmissing()to check for non-default function arguments:This is in contrast to checking the argument's value:
This makes life a bit harder for code that calls
catalogueExportbecause you can't do something like this:...because no possible value of
config$analysisIdscan specify that you want the default behavior (where noanalysisIdsargument was specified).I've tried using
substitute()to make an argument appear to be missing, but then that masks the default value ofanalysisIdsfrom thecatalogueExportfunction definition.I can use conditionals to build up a list of function arguments and pass that via
do.callbut that makes the code a bit less clear and it fixes my problem but leaves it for other people.How would you feel about a PR that replaces
missing()checks with value checks?The current uses of
missing():CatalogueExport/R/CatalogueExport.R
Line 114 in 066b8e7
CatalogueExport/R/CatalogueExport.R
Line 142 in 066b8e7
CatalogueExport/R/CatalogueExport.R
Line 151 in 066b8e7