I've got the following code. I want to loop through my dataset (which is a matrix) in steps of let's say 50.000 and perform biglm on it.
lengthdata <- 100340
stepsize <- 50000
for (i in seq(1, lengthdata, stepsize)){
if(i+stepsize > lengthdata){
## call function (i, lengthdata)
print(paste(i, " - ", lengthdata))
}
else {
## call function (i, i+stepsize)
print(paste(i, " - ", i + stepsize))
}
}
This is my output:
[1] "1 - 50001"
[1] "50001 - 100001"
[1] "100001 - 100340"
Is there a more effective or cleaner way of coding this? I'm quite unexperienced using R!