From d3814cb8f262c039e3f150b4f90f41fe51056124 Mon Sep 17 00:00:00 2001
From: Rosemary Li
Date: Wed, 6 Dec 2023 20:06:12 +0000
Subject: [PATCH] doc update
---
man/calculate_study_day.Rd | 60 ++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 man/calculate_study_day.Rd
diff --git a/man/calculate_study_day.Rd b/man/calculate_study_day.Rd
new file mode 100644
index 00000000..ec71af05
--- /dev/null
+++ b/man/calculate_study_day.Rd
@@ -0,0 +1,60 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/calculate_study_day.R
+\name{calculate_study_day}
+\alias{calculate_study_day}
+\title{\code{calculate_study_day} performs study day calculation}
+\usage{
+calculate_study_day(
+ ds_in,
+ ds_dm,
+ refdt,
+ tgdt,
+ study_day_var,
+ merge_key = "USUBJID"
+)
+}
+\arguments{
+\item{ds_in}{input data.frame that contains the target date.}
+
+\item{ds_dm}{reference date.frame that contains the reference date.}
+
+\item{refdt}{reference date from \code{ds_dm} that will be used as reference to
+calculate the study day.}
+
+\item{tgdt}{target date from \code{ds_in} that will be used to calcualte the study
+day.}
+
+\item{study_day_var}{the new study day variable name in the output. For
+example, AESTDY for AE domain for CMSTDY for CM domain.}
+
+\item{merge_key}{character to represents the merging key between \code{ds_in} and
+\code{ds_dm}.}
+}
+\value{
+a data.frame that takes all columns from \code{ds_in} and a new variable
+to represent the calculated study day.
+}
+\description{
+This function takes the an input data.frame and a reference data.frame (which
+is DM domain in most cases), and calculate the study day from reference date
+and target date. In case of unexpected conditions like reference date is not
+unique for each patient, or reference and input dates are not actual dates,
+NA will be returned for those records.
+}
+\examples{
+\dontrun{
+ ae <- data.frame(
+ USUBJID = c("study123-123", "study123-124", "study123-125"),
+ AESTDTC = c("2012-01-01", "2012-04-14", "2012-04-14")
+ )
+ dm <- data.frame(
+ USUBJID = c("study123-123", "study123-124", "study123-125"),
+ RFSTDTC = c("2012-02-01", "2012-04-14", NA)
+ )
+ ae$AESTDTC <- as.Date(ae$AESTDTC)
+ dm$RFSTDTC <- as.Date(dm$RFSTDTC)
+ calculate_study_day(ae, dm, "RFSTDTC", "AESTDTC", "AESTDY")
+}
+
+
+}