# Transform a dataset from WIDE to LONG GROUPED
library(drcte)
data(lotusOr)
datasetG <- melt_te(lotusOr, count_cols = 3:17, treat_cols = Stage,
monitimes = 1:15, n.subjects = rep(25,12))
head(datasetG, 16)
# Transform a dataset from WIDE to LONG UNGROUPED
datasetU <- melt_te(lotusOr, count_cols = 3:17, treat_cols = 1,
monitimes = 1:15, n.subjects = rep(25,12),
grouped = FALSE)
head(datasetU, 16)
# From LONG GROUPED to LONG UNGROUPED
datasetU2 <- ungroup_te(datasetG, count)[,-c(5, 6)]
head(datasetU2, 16)
# From LONG UNGROUPED to LONG GROUPED
datasetG2 <- group_te(datasetU)
head(datasetG2, 16)
# Chunk 7
# Decumulate a dataset with cumulative counts
data(lotusCum)
dataset_sd <- decumulate_te(lotusCum,
resp = nCum,
treat_cols = Stage,
monitimes = Time,
units = Dish,
n.subjects = rep(25, 12),
type = "count")
dataset_sd <- decumulate_te(lotusCum,
resp = Prop,
treat_cols = "Stage",
monitimes = Time,
units = Dish,
n.subjects = rep(25, 12),
type = "proportion")
Run the code above in your browser using DataLab