Skip to content

Commit

Permalink
Fix issues caused by new dplyr
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Nov 6, 2023
1 parent 19ae189 commit f5bf4ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/StudyPopulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ createStudyPopulation <- function(cohortMethodData,
.data$daysToEvent > -priorOutcomeLookback &
outcomes$daysToEvent < outcomes$daysToCohortEnd + riskWindowStart
) %>%
select("rowId")
pull("rowId")
} else {
priorOutcomeRowIds <- outcomes %>%
filter(
.data$daysToEvent > -priorOutcomeLookback &
.data$daysToEvent < riskWindowStart
) %>%
select("rowId")
pull("rowId")
}
population <- population %>%
filter(!(.data$rowId %in% priorOutcomeRowIds))
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-parameterSweep.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ test_that("Create study population functions", {
minDaysAtRisk = 1
)
expect_true(all(studyPop$timeAtRisk > 0))
peopleWithPriorOutcomes <- cohortMethodData$outcomes$rowId[cohortMethodData$outcomes$daysToEvent < 0]
peopleWithPriorOutcomes <- cohortMethodData$outcomes %>%
filter(outcomeId == 194133 & daysToEvent < 0) %>%
distinct(rowId) %>%
pull()
expect_false(any(peopleWithPriorOutcomes %in% studyPop$rowId))

aTable <- getAttritionTable(studyPop)
Expand Down
Binary file removed tests/testthat/testthat-problems.rds
Binary file not shown.

0 comments on commit f5bf4ca

Please sign in to comment.