[R] subtract 2 columns in a data.frame
Petr Pikal
petr.pikal at precheza.cz
Thu Sep 4 14:52:12 CEST 2003
Hi
On 4 Sep 2003 at 14:35, Ulrich Leopold wrote:
> > 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)
Beware of case sensitivity
propLSK.STONE.Pox0t30$Pox0t30stone-propLSK.STONE.Pox0t30$Pox0t30
shall work as expected
A little bit less complicated names of data frames and variables could
be more readable and more error prone.
Cheers
Petr
>
> 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/sta
fffg/index
> .html
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list