
I want the reshaped data to look like this.

  plate.id       HYB                    well.id   rlt1.control1
well.id   rlt1.control1   well.id    rlt1.disease1       well.id
rlt1.disease2
1       P1       SKOV3hyb           A1            0.190
A2     0.210         B1            0.217                B2
0.190
2        P1     SKOV3hyb           A3             0.205
A4     0.206         B3            0.371                B4
0.56


Thanks
Sharad

On Thu, Oct 7, 2010 at 7:09 PM, djmuseR [via R] <
ml-node+2967676-1432920781-6232@n4.nabble.com<ml-node%2B2967676-1432920781-6232@n4.nabble.com>
> wrote:

> Hi:
>
> Is this what you were looking for?
>
> 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
>
> dfwide <- reshape(df, idvar = c('plate.id', 'well.id', 'HYB'), timevar =
> 'Group',
>                   direction = 'wide')
> > dfwide
>   plate.id well.id      HYB rlt1.control1 rlt1.disease1 rlt1.disease2
> 1       P1      A1 SKOV3hyb         0.190            NA            NA
> 2       P1      A2 SKOV3hyb            NA         0.210            NA
> 3       P1      A3 SKOV3hyb         0.205            NA            NA
> 4       P1      A4 SKOV3hyb            NA         0.206            NA
> 5       P1      B1 SKOV3hyb            NA            NA         0.217
> 6       P1      B2 SKOV3hyb            NA            NA            NA
> 7       P1      B3 SKOV3hyb            NA            NA         0.371
> 8       P1      B4 SKOV3hyb            NA            NA            NA
>   rlt1.control2
> 1            NA
> 2            NA
> 3            NA
> 4            NA
> 5            NA
> 6         0.646
> 7            NA
> 8         0.560
>
>
> HTH,
> Dennis
>
> On Thu, Oct 7, 2010 at 7:54 AM, 1Rnwb <[hidden email]<http://user/SendEmail.jtp?type=node&node=2967676&i=0>>
> wrote:
>
> >
> > 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<http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2966918.html?by-user=t>
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=2967676&i=1>mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] <http://user/SendEmail.jtp?type=node&node=2967676&i=2>mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
> ------------------------------
>  View message @
> http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2967676.html
> To unsubscribe from subtraction based on two groups in a dataframe, click
> here<http://r.789695.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2716104&code=c2JwdXJvaGl0QGdtYWlsLmNvbXwyNzE2MTA0fDU4ODg0MTYwOQ==>.
>
>
>

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

	[[alternative HTML version deleted]]

