I need to convert an integer variable into a Date
to run a chart measuring pre-baseline up to post intervention measurements. The variable is listed here:
project_month : int [1:29] -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 ...
I have tried several methods but none seem to work. Below are various ways I've attempted:
qic_u_chart <- QIH_data$data %>%
mutate(x= as.Date(project_month))
Warning message: “Unknown or uninitialised column:
data
.”
Error in UseMethod("mutate_"): no applicable method for 'mutate_' applied to an object of class "NULL"
QIH_data <- QIH_data %>%
mutate(project_month =
if_else(project_month <= as.Date("-1"), "baseline", "intervention"))
str(QIH_data)
Error in charToDate(x): character string is not in a standard unambiguous format