Use R to determine the following Mrs S is participating in a
Use R to determine the following:
Mrs. S is participating in a clinical trial. She started treatment on March 3, 2000 and is expected to have a follow-up visit every 6-months for the next three years.
(a) Create a vector of the dates when Mrs. S is expected to show up for her followup visit.
(b) Mrs. S showed up on the following dates, enter these dates into R as Date objects. 9/10/2000, 2/10/2001, 9/16/2001, 2/23/2002, 9/9/2002 3/28/2003
(c) It is unrealistic to expect Mrs. S to show up on the dates from part (a). However, did Mrs. Smith have a follow-up appointment within three weeks of each expected follow-up date?
Solution
a)
st <- as.Date(\"03/03/2000\", format=\"%d/%m/%Y\")
en <- as.Date(\"31/03/2003\", format=\"%d/%m/%Y\")
followup_dt <- seq(en, st, by = “6 months”)
followup_dt <- followup_dt[-1]
print(followup_dt)
b)
temp_dt <- c(\"9/10/2000\", \"2/10/2001\", \"9/16/2001\", \"2/23/2002\", \"9/9/2002\", \"3/28/2003\")
new_dt <- as.Date(temp_dt, \"%m/%d/%Y\")
print(new_dt)

