# NOT RUN {
### Long form ###
data(PTSD)
PTSD[,2:4] <- apply(PTSD[,2:4], 2, function(x) ifelse(x >= 3, 1, 0))
PTSD[,5] <- ifelse(PTSD[,5] >= 6 , 1, 0)
PTSD <- data.frame(lapply(PTSD, function(x) as.factor(x)))
PTSD
str(PTSD)
head(PTSD, 10)
fit <- vlda(x = PTSD, object = "subject", time = "time", type = "long")
vlda_plot(fit)
## row and column ##
data(PTSD_row)
data(PTSD_column)
PTSD_row <- as.matrix(PTSD_row)
PTSD_column <- as.matrix(PTSD_column)
fit2 <- vlda_add(fit, add.row = PTSD_row, add.col = PTSD_column)
vlda_plot(fit2)
### Wide form ###
data(Depression)
wide.fit <-
vlda(
x = Depression,
object = "Case",
time = c("1week", "2weeks", "4weeks"),
type = "wide"
)
vlda_plot(wide.fit)
# }
Run the code above in your browser using DataLab