[BioC] merge two dataframes
Sean Davis
sdavis2 at mail.nih.gov
Tue Feb 13 12:11:33 CET 2007
On Tuesday 13 February 2007 04:29, Ghislaine Guigon wrote:
> Hi,
>
> I would try to merge 2 dataframes x1, x2 with same structure. ID is the
> common columns. I don't understand why the result, x, is composed of NA ?
> Is someone understand the problem ?
>
> The code is :
> > x2[1:3,]
>
> ID sVOL logSignalMean
> 4340 8559;27*L11 3189.818 11.6392584
> 4335 8547;27*L9 3419.657 11.7396359
> 3267 6441;27*I18 0.000 -0.4460873
>
> > x1[1:3,]
>
> ID sVOL logSignalMean
> 4339 8557;25*L11 2972.267 11.5373480
> 4334 8545;25*L9 3380.747 11.7231263
> 3266 6439;25*I18 0.000 -0.4460873
>
> > x<- merge(x1,x2,by.x=ID,by.y=ID,suffixes=c("1","2"))
The by argument needs to be a number, a logical vector, or character. You are
supplying a variable which is being interpreted as one of these. Change the
statement to:
x<- merge(x1,x2,by.x="ID",by.y="ID",suffixes=c("1","2"))
That will probably get you the answer you want.
> > x[1:3,]
>
> ID sVOL1 logSignalMean1 sVOL2 logSignalMean2
> NA <NA> NA NA NA NA
> NA.1 <NA> NA NA NA NA
> NA.2 <NA> NA NA NA NA
>
> thanks,
> gg
More information about the Bioconductor
mailing list