[R] subtract 2 columns in a data.frame

Ulrich Leopold uleopold at science.uva.nl
Thu Sep 4 14:35:11 CEST 2003


> 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?

Ulrich


-- 
__________________________________________________

Ulrich Leopold MSc.

Department of Physical Geography
Institute for Biodiversity and Ecosystem Dynamics
Faculty of Science
University of Amsterdam
Nieuwe Achtergracht 166
NL-1018WV Amsterdam

Phone:	+31 20 525 7456 (7451 Secretary)
Fax:	+31 20 525 7431
Mobile:	+31 64 220 3028
Email:	uleopold at science.uva.nl
URL:	www.science.uva.nl/ibed/research/Research_Fields/fg/stafffg/index.html




More information about the R-help mailing list