Skip to content

Commit

Permalink
add_partial_keys redcap_arm factor -> character
Browse files Browse the repository at this point in the history
  • Loading branch information
rsh52 committed Oct 15, 2024
1 parent 2d0e61f commit 2c5046b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_partial_keys <- function(db_data,
db_data <- db_data %>%
mutate(
redcap_event = sub(pattern, "\\1", {{ var }}),
redcap_arm = as.factor(sub(pattern, "\\2", {{ var }}))
redcap_arm = as.character(sub(pattern, "\\2", {{ var }}))
)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ test_that("add_partial_keys works", {
expect_s3_class(out, "data.frame")
expect_true(nrow(out) > 0)

expected_redcap_arm_col <- factor(c(1, 1, 1, 1, "1b"))
expected_redcap_arm_col <- c("1", "1", "1", "1", "1b")
expect_equal(out$redcap_arm, expected_redcap_arm_col)
})

Expand Down

0 comments on commit 2c5046b

Please sign in to comment.