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

Revise RMD calculations #47

Merged
merged 5 commits into from
Jun 4, 2024
Merged

Revise RMD calculations #47

merged 5 commits into from
Jun 4, 2024

Conversation

dom-muston
Copy link
Collaborator

Use a consistent and simpler approach for discretized calculations that depends on calculation of PPD mortality by method

@@ -44,6 +44,7 @@
#' - pf: RMD in PF state
#' - pd: RMD in PD state
#' - os: RMD in either alive state
#' @importFrom rlang .data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: this is already in NAMESPACE, so the documentation doesn't need to be regenerated

importFrom(rlang,.data)

@@ -87,22 +88,22 @@ drmd_psm <- function(ptdata, dpam, psmtype="simple", Ty=10, discrate=0, lifetabl
ds <- ds |>
dplyr::mutate(
# Derive the background mortality for this timepoint
cqx = 1 - dplyr::lead(clx)/clx,
cqx = 1 - dplyr::lead(.data$clx)/.data$clx,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your motivation for prefixing all the variables with .data$? Are you trying to remove R CMD check NOTEs about undefined global variables?

An alternative to prefixing with .data$ is to add the variables you use in tidyverse functions to utils::globalVariables() (you'd also need to add utils to Imports). You can see how we do this in {gsDesign2} and {simtrial}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably a better way! Yes it's to remove R CMD check notes. There are various other functions with the same issue/behavior, so I should go through them all - thanks for showing me the better practice in gsDesign2 and simtrial.

@dom-muston dom-muston merged commit 3241077 into main Jun 4, 2024
7 checks passed
@dom-muston dom-muston deleted the feature_drmd branch June 4, 2024 21:47
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.

2 participants