I've created a data frame with a list of IDs.
myIDs <- (c(45655,45656,45657,45658,45659))
myIDs <- as.data.frame(myIDs)
And I have to call as many API queries per ID. I wanted to create a loop this way:
apiP1 <- "http://api.mydomain.com/2.0/facts/"
apiP2 <- "?Authorization=mytoken"
for (i in myIDs$myIDs[1:5]){
mydata <- fromJSON(file = paste0(apiP1,i,apiP2))
}
I'm wondering which way I should take to get all rows from the APIs in 1 single data frame. I was thinking about creating 1 object per request and then use a RBIND rule.
In order to do that, how do I automatically create objects like:
mydata45655 which should contain the data from the API with ID 45655
mydata45656 which should contain the data from the API with ID 45656
Etc.