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        0.56

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 <sbpuro...@gmail.com> 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
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org 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]]

______________________________________________
R-help@r-project.org 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.

Reply via email to