Using my Data
, I was wondering if there is a way to achieve my Desired_output
(an object of class table
or matrix
)?
I tried the following without success:
with(Data, table(group, task_type, time.))
Data = data.frame(group=rep(c("Sim","Com"), each=4),
task_type = c(rep(c("S","C"),2),rep(c("C","S"),2)),
time = time <- rep(1:4,2),
time. = ifelse(time%%2==1, "odd", "even"))
Desired_output="
task_type
group C S
Com odd even
Sim even odd
"