Ulrich Leopold [EMAIL PROTECTED] writes:
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.
E.g.,
mydata$difference - mydata$x - mydata$y
--
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.
On 4 Sep 2003, Ulrich Leopold wrote:
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.
Suppose your data frame is called foo, and you want the first column minus
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:
Dear list,
sorry for having bothering you. I found the problem. It was the a stupid
error made by me. R could not recognise the variable as it is of course case
sensitive for names. So I specified the wrong variable name and R did
complain about it with numeric(0).
Ulrich
Peter Dalgaard BSA
Ulrich Leopold [EMAIL PROTECTED] 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
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