Re: [R] How to perform arithmetic across rows

2010-10-28 Thread Joshua Wiley
Hi Nick, Take a look at ?cbind and ?"[" Here is some (untested) code that is how I might go about it. It takes advantage of the fact that a single value will be recycled to equal the necessary length. Then I just assign over the NA in row 24. myframe <- cbind(myframe, New = NA) myframe[24, "Ne

[R] How to perform arithmetic across rows

2010-10-28 Thread Nick Ackerman
Hi All, I have a data frame (myframe) with variables (columns) A,B,C and 100 records (rows) for each. Column A is numeric. I would like to append a column to myframe that subtracts the value in row 24 of A from row 1 of A. In this procedure the first 23 rows of the new column will necessarily be