Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check found NA's in TADA_FlagContinuousData's TADA.ContinuousData.Flag #484

@cristinamullin

Description

@cristinamullin

Describe the bug

TADA_FlagContinuousData sometimes populates TADA.ContinuousData.Flag with all NA's.

══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-ResultFlagsIndependent.R:67:3'): No NA's in independent flag columns ──
Error in `if (!is.na(noncont.data$ActivityStartDateTime[i])) {
    info_match <- which(noncont.data$TADA.LatitudeMeasure == 
        noncont.data$TADA.LatitudeMeasure[i] & noncont.data$TADA.LongitudeMeasure == 
        noncont.data$TADA.LongitudeMeasure[i] & noncont.data$OrganizationIdentifier == 
        noncont.data$OrganizationIdentifier[i] & noncont.data$TADA.ComparableDataIdentifier == 
        noncont.data$TADA.ComparableDataIdentifier[i] & ((noncont.data$TADA.ActivityDepthHeightMeasure.MeasureValue == 
        noncont.data$TADA.ActivityDepthHeightMeasure.MeasureValue[i]) | 
        (is.na(noncont.data$TADA.ActivityDepthHeightMeasure.MeasureValue) & 
            is.na(noncont.data$TADA.ActivityDepthHeightMeasure.MeasureValue[i]))) & 
        ((noncont.data$TADA.ResultDepthHeightMeasure.MeasureValue == 
            noncont.data$TADA.ResultDepthHeightMeasure.MeasureValue[i]) | 
            (is.na(noncont.data$TADA.ResultDepthHeightMeasure.MeasureValue) & 
                is.na(noncont.data$TADA.ResultDepthHeightMeasure.MeasureValue[i]))) & 
        ((noncont.data$TADA.ActivityTopDepthHeightMeasure.MeasureValue == 
            noncont.data$TADA.ActivityTopDepthHeightMeasure.MeasureValue[i]) | 
            (is.na(noncont.data$TADA.ActivityTopDepthHeightMeasure.MeasureValue) & 
                is.na(noncont.data$TADA.ActivityTopDepthHeightMeasure.MeasureValue[i]))) & 
        ((noncont.data$TADA.ActivityBottomDepthHeightMeasure.MeasureValue == 
            noncont.data$TADA.ActivityBottomDepthHeightMeasure.MeasureValue[i]) | 
            (is.na(noncont.data$TADA.ActivityBottomDepthHeightMeasure.MeasureValue) & 
                is.na(noncont.data$TADA.ActivityBottomDepthHeightMeasure.MeasureValue[i]))) & 
        ((noncont.data$ActivityRelativeDepthName == noncont.data$ActivityRelativeDepthName[i]) | 
            (is.na(noncont.data$ActivityRelativeDepthName) & 
                is.na(noncont.data$ActivityRelativeDepthName[i]))))
    time_diff <- abs(difftime(noncont.data$ActivityStartDateTime[i], 
        noncont.data$ActivityStartDateTime[info_match], units = "hours"))
    within_window <- info_match[time_diff <= time_difference]
    info_match <- intersect(info_match, within_window)
    if (length(info_match) >= 1) {
        noncont.data$TADA.ContinuousData.Flag[info_match] <- "Continuous"
    }
}`: argument is of length zero
Backtrace:

 1. └─EPATADA::TADA_FlagContinuousData(testdat, clean = FALSE, flaggedonly = FALSE) at test-ResultFlagsIndependent.R:67:3

Expected behavior

The flag field should not include NA's.

Reminders for TADA contributors addressing this issue

Bug fixes should include all the following work:

  • Create or edit the function/code.

  • Document all code using line/inline and/or multi-line/block comments
    to describe what is does.

  • Create or edit tests in tests/testthat folder to help prevent and/or
    troubleshoot potential future issues.

  • Create or edit the function documentation. Include working
    examples.

  • Update or add the new functionality to the appropriate vignette
    (or create new one).

  • If function/code edits made as part of this issue impact other
    functions in the package or functionality in the shiny app, ensure
    those are updated as well.

  • Run TADA_UpdateAllRefs(), TADA_UpdateExampleData(), styler::style_pkg(),
    devtools::document(), and devtools::check() and address any new notes or
    issues before creating a pull request.

  • Run more robust check for releases: devtools::check(manual = TRUE,
    remote = TRUE, incoming = TRUE)

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