Tena koe Keith ?which
perhaps. As in: which(Tanks=='h4')-which(Tanks=='a3') HTH ... Peter Alspach > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Marlin Keith Cox > Sent: Wednesday, 10 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 "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.frame(length=c(1,2,3,4), > Tanks=c("a3","a4","c4","h4")) > > ??? > > Much appreciated, keith > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.