1

I am trying to rbind.pages with jsonlite from web where some of the data files are missing(for example values for aa are missing).

temp<- c("6702","1","67")
library(jsonlite)
baseurl <- "https://api.angel.co/1/startups/"
pages <- list()
for(i in 1:3){
  mydata<- fromJSON(paste0(baseurl,temp[[i]]),flatten= TRUE)
 pages[[i+1]] <- mydata
}
out<- rbind.pages(pages[sapply(pages, length)>2])

I am getting the following errors. Any suggestions on how to address this? Thanks.

Error: Error in open.connection(con, "rb") : HTTP error 404.
Error: all(vapply(pages, is.data.frame, logical(1))) is not TRUE
user3570187
  • 1,743
  • 3
  • 17
  • 34
  • Just like with your [last question](http://stackoverflow.com/questions/30539282/combining-many-data-frames-with-rbind-and-pages), we need a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – MrFlick May 30 '15 at 03:07
  • Am I allowed to specify external urls/api link? – user3570187 May 30 '15 at 03:21
  • When are you doing `pages[[i+1]] <- mydata` rather than `pages[[i]] <- mydata`? You shound't have `NULL` items in the list for `rbind.pages()` to work – MrFlick May 30 '15 at 03:29
  • Exactly i don't know when i am getting null values. So is there a way i can handle them so i can attach using rbind. I tried the code you mentioned it didn't work. – user3570187 May 30 '15 at 03:35

1 Answers1

3

rbind.pages doesn't appear to like "empty" lists. You should filter your list to exclude them

out<- rbind.pages(pages[sapply(pages, length)>0])
MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • it worked but as i running others i am getting an http error and it is stopping the looping operation. Any suggestions? I am editing the data points for reproducibility. – user3570187 May 30 '15 at 03:57