Closed ShiyuC closed 4 months ago
I can start on this one. Just wondering if ds_in
argument should be a data.frame in R? Do we allow data.table etc?
@yli110-stat697, Yes, ds_in is a data frame in R. I think it would be nice to keep it as a data frame in the domain automation process.
Is it possible to join DM data in air and calculate -DY? (just suggestion) otherwise logic looks perfect. Thanks
@yli110-stat697 I'll modify the description based upon what is discussed today
@yli110-stat697 I'll modify the description based upon what is discussed today
Hi @ShiyuC so I will be joining DM to get the reference date right?
@yli110-stat697 I'll modify the description based upon what is discussed today
Hi @ShiyuC so I will be joining DM to get the reference date right?
Hi @yli110-stat697 , no need to join DM. DM is supposed to be in the package environment, so the reference dates just need to be referenced as a vector. You can refer to oak_derive_studyday() in roak package as an example
Hi team, I believe for the sdtm.oak
we better start explicitly passing the required domains into a functions via a parameter instead of obtaining it from the package environment. Please bring this up during the Wednesday stand-up.
Feature Idea
Purpose The function performs study day calculation
Functionality The feature uses an algorism that is compliant with CDISC SDTM rules. It uses two date values that are formatted according to ISO8601 rules. One of the dates
refdt
is called the 'reference' date and is the baseline against which the 'target' datetgdt
is used to determine the study day value. The input dates are expected in a data frame The study day (SD) value is computed as follows: If Reference Date <= Target Date then SD = (Target Date) - (Reference Date) + 1 else if Reference Date > Target Date then SD = (Target Date) - (Reference Date)Relevant Input
The input data frame ds_in should contain
refdt
andtgdt
variables.Relevant Output
A character vector with the study days that were calculated of the same length as input data frame.
Reproducible Example/Pseudo Code
ds_in <- data.frame( RFSTDTC = c( "2012-01-01", "2012-04-14", "2012-04-14", "2010-05-02", "2010---10", "2012", NA, "2012-01-01", NA, "2010-04-15", "2010-04-15" ), XXDTC = c( "2012-02-01", "2012-04-14", "2012-04-13", "2011-05-02", "2012-02-03", "2012-06-06", "2012-01-01", NA, NA, "2009---12", "2009-12-12" ) ) refdt <- "RFSTDTC" tgdt <- "XXDTC" calculate_study_day(ds_in, refdt, tgdt)