[R] adding rows

eliza botto eliza_botto at hotmail.com
Thu Sep 25 21:50:49 CEST 2014


Dear useRs,
Here is my data with two columns and 20 rows.
> dput(TT)
structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 48, 72, 96, 120, 144, 168, 192, 216, 240, 264, 288, 312, 336, 360, 384, 408, 432, 456, 480), .Dim = c(20L, 2L), .Dimnames = list(NULL, c("", "SS")))
I first of all want to sum up continuously  two rows (1 & 2, 3 & 4, 5 & 6 and so on) of each column.
Then I want to sum up 3 rows as (1-2-3,4-5-6,..... 16-17-18) and since 19th and 20th rows do not up 3 rows, so they should be ignored.
Similarly with 4 sets of rows and 5 sets of rows and even 6.
I hope I was clear.
Thankyou so very much in advance,
Eliza  		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list