-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
SERREAS derivation in AEL03 needs correction #269
Comments
Hi @kathrinflunkert could you provide a reproducible example that highlights the issue? Thanks! |
Here is a reproducible example where I changed AESLIFE for one subject to 'Y' so that this patients has two records where AESLIFE == "Y" and AESHOSP == "Y" (i.e. two Reasons classified as serious are present):
The code below is taken from the TLG Catalog:
The resulting list only shows one of the two Reasons classified as serious in the very last column even though there are two reasons present in the data.
|
@kathrinflunkert I probably need to see an example of real output to understand what is missing. I suspect that what you want is not really in scope with {rlistings} as it was defined only as a direct print of a data.frame. If you want to collapse two lines with a column that has "2, 3", I would try a manual update of these values. If that is what you want I could create a workaround with grouping and paste(). I think a custom function of that kind could be added for this specific cases to {rlistings} as a pre-processing tool |
@Melkiades I agree that this is not a problem to be solved within the rlistings package, but this here is the Github section for tlg-catalog and the data preprocessing code for AEL03 on the tlg-catalog is leading to incorrect outputs as described above. That is why I as a user reported the issue here. I am not sure what is the best way to solve it. Adding the code to derive a new column that has a value of "2, 3" could be one way, maybe there is another way, I don't know. |
Yes, if it is an issue of pre-processing this is the right place. The values with multiple outcomes like "2, 3" need to be derived in pre-processing using {dplyr} |
Here is a solution: test_data <- tibble(
USUBJID = c("01", "02", "03"),
AESDTH = c("N", "Y", "N"),
AESLIFE = c("Y", "N", "Y"),
AESHOSP = c("N", "Y", "Y"),
AESDISAB = c("N", "N", "N"),
AESCONG = c("Y", "N", "N"),
AESMIE = c("N", "Y", "N")
)
test_data %>%
mutate(
SERREAS = purrr::pmap_chr(
list(AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE),
~ paste(which(c(...) == "Y"), collapse = ", ")
)
)
|
Another one (without test_data %>%
rowwise() %>%
mutate(
SERREAS = paste(
which(
c(AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE) == "Y"
),
collapse = ", "
)
) %>%
ungroup() |
Thanks so much!! I will update TLG-catalog with this if @kathrinflunkert is fine with this addition |
Many thanks @yurovska! |
Fixes #269 --------- Signed-off-by: Davide Garolini <[email protected]> Signed-off-by: Davide Garolini <[email protected]> Co-authored-by: Pawel Rucki <[email protected]> Co-authored-by: Emily de la Rua <[email protected]> Co-authored-by: Joe Zhu <[email protected]>
There can be multiple reasons why an AE was serious, e.g. required hospitalization and was life-threatening. In these cases the listing should display both these reasons as "2, 3", but with the current case-when setup it would only ever display one reason.
The text was updated successfully, but these errors were encountered: