[R] asking for help

Thomas Mailund mailund at birc.au.dk
Tue Apr 25 11:20:01 CEST 2017


If you write something like

indices <- rep(1:(163863/6069), each = 6069)

you can get the i’th block of rows with

table[indices == i,]

It looks like a little more work than a loop would be since you have to run through all rows for each block, but the implicit loop in this approach is likely to be faster than an explicit for-loop.

Cheers
 Thomas

On 25 Apr 2017, 07.01 +0200, Saifuddin, Miah Mohammad <miah.mohammadsaifudd at mavs.uta.edu>, wrote:
I have a data frame having 163863 values. I want to subset it so that each set has 6069 values in it. for example 1:6069 as first, 6070: 6070+6068 as second. how can I do that, preferably in a loop.


TIA

[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list