Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct the way to assign levels attribute for observation dataset #179

Merged

Conversation

wangben718
Copy link
Collaborator

@wangben718 wangben718 commented Jan 22, 2024

bug fix:

forestly_adsl_mod <- forestly_adsl |>
  dplyr::mutate(
    TRT01A = ifelse(USUBJID == "01-718-1355", "", TRT01A),
    TRTA = factor(TRT01A, levels = c("Xanomeline Low Dose", "Placebo"), labels = c("Low Dose", "Placebo"))
  )
forestly_adae_mod <- forestly_adae |>
  dplyr::filter(USUBJID != "01-718-1355")
factor(forestly_adae_mod$TRTA, levels = forestly_adsl_mod$TRTA)

This approach will make "Xanomeline Low Dose" to NA since "Low Dose" could not be found in forestly_adae_mod$TRTA as input of factor().

forestly_adae_mod$TRTA <- factor(forestly_adae_mod$TRTA, levels(forestly_adsl_mod$TRTA))
levels(forestly_adae_mod$TRTA) <- levels(forestly_adsl_mod$TRTA)

This approach works well.

@nanxstats nanxstats merged commit c449ca8 into main Jan 22, 2024
8 checks passed
@nanxstats nanxstats deleted the 100-prepare_ae_specific-pop-up-error-if-var-variable-has-na branch January 22, 2024 23:25
@wangben718 wangben718 linked an issue Mar 11, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why TRTA is not allowed to be missing in ADSL? prepare_ae_specific() pop up error if var variable has NA
3 participants