Re: [R] Code to construct table with paired data

2017-04-08 Thread Mauricio Cardeal
Thank you Peter! Great solutions! That's exactly what I was looking for. MaurĂ­cio Cardeal Em 08/04/2017 09:11, peter dalgaard escreveu: > Here's one way: > >> ddw <- reshape(dd, direction="wide", idvar="pair", timevar="treatfac") >> names(ddw) > [1] "pair" "imprfac.A" "imprfac.B" >> xtabs(

Re: [R] Code to construct table with paired data

2017-04-08 Thread peter dalgaard
Here's one way: > ddw <- reshape(dd, direction="wide", idvar="pair", timevar="treatfac") > names(ddw) [1] "pair" "imprfac.A" "imprfac.B" > xtabs(~ imprfac.A + imprfac.B, ddw) imprfac.B imprfac.A + - + 1 3 - 2 1 (reshape() is a bit of a pain to wrap one's mind around;

[R] Code to construct table with paired data

2017-04-08 Thread Mauricio Cardeal
Hi! Is it possible to automatically construct a table like this: #treat B # improvement # + - #treat A improvement + 1 3 # - 2 1 From these data: pair <- c(1,1,2,2,3,3,4,4,5,5,6,6,