[R] subtract 2 columns in a data.frame

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Sep 4 14:49:01 CEST 2003


Ulrich Leopold <uleopold at science.uva.nl> writes:

> > E.g.,
> > mydata$difference <- mydata$x - mydata$y
> >
> 
> That's what I thought, but I get the following message:
> 
>  > propLSK.STONE.Pox0t30$Pox0t30STONE-propLSK.STONE.Pox0t30$Pox0t30
> numeric(0)
> 
> Does it mean the resulting vector is empty? If yes, what could be the
> reason for it? Both columns are available:
> 
>       UGreen    Pox0t30 Pox0t30Stone
> 1         0  37.150000    16.461500
> 2         0   6.833330     7.464404
> 3         0   9.750000    15.616870
> 4         0  15.050000    19.146500
> 5         0  13.266700    10.515750
> 6         0  34.300000    27.304840
> 7         0  45.800000    27.217171
> 8        NA  23.200000    16.844601
> 9         0  13.600000    28.051821
> 10        0  16.750000     6.021914
> 11        0  16.433300     3.832123
> 12        0  17.333300     3.905555
> 
> 
> What am I missing?

Case sensitivity, it seems...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list