I want to have a loop to retrieve data from this function listOMLRunEvaluations the function has a limit=10000. How can I make a loop in R to call this function either by task.id= i or by limit and offlimit (retrieve every 10000 rows in each iteration).
Asked
Active
Viewed 443 times
1
-
1Please make this question *reproducible*. This includes sample code (including listing non-base R packages), sample data (e.g., `dput(head(x))`), and expected output. Refs: https://stackoverflow.com/questions/5963269, https://stackoverflow.com/help/mcve, and https://stackoverflow.com/tags/r/info. – r2evans Nov 06 '18 at 20:42
1 Answers
0
You could use a for loop with Sys.sleep() in case you also have a limit of request per second:
result <- c()
for(i in 1:10) {
new <- listOMLRunEvaluations()
result <- c(old, new)
Sys.sleep(10)
}
gaut
- 2,299
- 1
- 11
- 24
-
2Strongly recommend against the concept of building a response vector like this. I'd suggest rather you do something like `l – r2evans Nov 06 '18 at 20:42
-
can you please explain more in using lapply in my functionlistOMLRunEvaluations @r2evans – Bayan Nov 13 '18 at 20:13
-
Bayan, I'm generally willing to help, but ... what is there for me to help with? Perhaps you mean `result – r2evans Nov 13 '18 at 23:00