[R] subtraction based on two groups in a dataframe

1Rnwb sbpurohit at gmail.com
Thu Oct 7 16:54:37 CEST 2010


Hi The reshape suggestions works great on my previous data, but I am unable
to make is work on the new dataset. It actually works but only gives me the
output of single row, instead of 96 rows.
The dataset has two control groups control 1 and control 2, two disease
groups viz disease 1 and disease 2 a total of 384 values
plate.id	well.id	Group	HYB	rlt1
P1	A1	control1	SKOV3hyb	0.19
P1	A2	disease1	SKOV3hyb	0.21
P1	A3	control1	SKOV3hyb	0.205
P1	A4	disease1	SKOV3hyb	0.206
P1	B1	disease2	SKOV3hyb	0.217
P1	B2	control2	SKOV3hyb	0.646
P1	B3	disease2	SKOV3hyb	0.371
P1	B4	control2	SKOV3hyb	0.56

when I use
ydat <- reshape(ydat, idvar = c('plate.id','HYB'), timevar
='Group',direction = 'wide')

I get

plate.id	well.id.control1	HYB.control1	rlt1.control1	well.id.disease1
HYB.disease1	rlt1.disease1	well.id.disease2	HYB.disease2	rlt1.disease2
well.id.control2	HYB.control2	rlt1.control2
P1	A1	SKOV3hyb	0.19	A2	SKOV3hyb	0.21	B1	SKOV3hyb	0.217	B2	SKOV3hyb	0.646


instead of 96 rows of data, only one row comes, i tried new.row.names but
that is not working.
I would appreciate the help.
Thanks

-- 
View this message in context: http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2966918.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list