Not exactly sure what you are asking: is this it
> DF <- data.frame(length=c(1,2,3,4),
+ Tanks=c("a3","a4","c4","h4"))
> DF
length Tanks
1 1a3
2 2a4
3 3c4
4 4h4
> DF$length[DF$Tanks == 'h4'] - DF$length[DF$Tanks == 'a3']
[1] 3
>
On Tue, Feb 9, 2010 at 9:37 P
February 2010 3:37 p.m.
> To: r-help@r-project.org
> Subject: [R] simple subtraction in a single vector
>
> OK, this is very elementary, but I need help. I have looked
> in Verzani, past postings etc.
>
> Problem: I need to subtract the "length" date between "
OK, this is very elementary, but I need help. I have looked in Verzani,
past postings etc.
Problem: I need to subtract the "length" date between "h4" and "a3" #which
would be 4-1
I would rather not convert the two columns into four columns (with headings
being "a3","a4","c4","h4").
DF <- data
3 matches
Mail list logo