Skip to content

Use of missing() makes catalogueExport a little harder to use #51

Description

@actualben

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:

 if (analysisIds != "") { 

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():

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions