Skip to content

Verify that reference columns are present if they are required for any calculation #492

@billdenney

Description

@billdenney

At this location:

# Now check specific columns

Please:

  • Check if any reference is needed
  • If so, require that a column named "interval_id" is present in the intervals (error if not)
  • If so, verify that the reference col has a valid "interval_id" in it (cannot be the interval_id of the current row)

The tests will likely look something like:

# Okay because no secondary parameters are present
check.interval.specification(data.frame(start = 0, end = 1, cmax = TRUE)
# Error that no `clr.last_ref_interval_id` column is present
check.interval.specification(data.frame(start = 0, end = 1, clr.last = TRUE)
# Error that no `interval_id` column is present
check.interval.specification(data.frame(start = 0, end = 1, clr.last = TRUE, clr.last_ref_interval_id = "a")
# Error that `clr.last_ref_interval_id` column cannot be `NA` when `clr.last` is TRUE
check.interval.specification(data.frame(start = 0, end = 1, clr.last = TRUE, clr.last_ref_interval_id = NA)
# Error that `clr.last_ref_interval_id` is not present in the `interval_id` column
check.interval.specification(data.frame(start = 0, end = 1, clr.last = TRUE, clr.last_ref_interval_id = "a", interval_id = "b")
# Error that `clr.last_ref_interval_id` and `interval_id` column must be the same `class()`
check.interval.specification(data.frame(start = 0, end = 1, clr.last = TRUE, clr.last_ref_interval_id = "a", interval_id = 1)
# Success
check.interval.specification(data.frame(start = 0, end = 1, clr.last = c(FALSE, TRUE), clr.last_ref_interval_id = c(NA, "a"), interval_id = c("a", NA))

Follows #491
Related to #76

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