[R] subtract 2 columns in a data.frame
Spencer Graves
spencer.graves at pdf.com
Thu Sep 4 13:19:55 CEST 2003
Is the following what you want?
> DF <- data.frame(a=1:2, b=3:4)
> DF$a-DF$b
[1] -2 -2
> DF[,"a"]-DF[,"b"]
[1] -2 -2
hope this helps. spencer graves
Ulrich Leopold wrote:
> Dear list,
>
> could someone point me to the right command to subtract 2 columns in a
> data.frame. Might be a bit embarrassing question. But I cannot figure
> out how to do this simple command in R.
>
> Thanks, Ulrich
More information about the R-help
mailing list