Re: [R] summing items within a row

2010-05-13 Thread Q
Thank you Dennis. That was a great idea and it worked quite well! -- View this message in context: http://r.789695.n4.nabble.com/summing-items-within-a-row-tp2195458p2196793.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] summing items within a row

2010-05-12 Thread Dennis Murphy
Hi: Does the following work? xx <- matrix(1:5, nrow = 4, ncol = 10) > colnames(xx) <- paste(rep(LETTERS[1:5], 2), rep(1:2, each = 5), sep = '') > xx A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 [1,] 1 5 4 3 2 1 5 4 3 2 [2,] 2 1 5 4 3 2 1 5 4 3 [3,] 3 2 1 5 4 3 2 1 5 4 [4,] 4

Re: [R] summing items within a row

2010-05-11 Thread David Winsemius
On May 11, 2010, at 8:36 PM, Q wrote: Hello, I am trying to figure out how to do a sum of items within a row. For example, I have a data frame something like this: A1 B1 ... A2 B2 ... 1 1 41 4 2 2 52 5 3 3 63 6 What I want, is for each row, to get

[R] summing items within a row

2010-05-11 Thread Q
Hello, I am trying to figure out how to do a sum of items within a row. For example, I have a data frame something like this: A1 B1 ... A2 B2 ... 1 1 41 4 2 2 52 5 3 3 63 6 What I want, is for each row, to get A1 + A2, B1 + B2, etc. which would, perha