r - how do you check if a lists exists or not? -


i reading html table. result, 1 list , 2 lists.

url<-c("example.com/table") q <- html(url1) %>% html_table(fill=t) if(exists('q[[2]]')){ 

i need put in check if q[[2]] exists something, if process q[[1]]

i tried exists ,

if(!is.na(q[[2]])) 

i error on both:

error in q[[2]] : subscript out of bounds 

how check if lists exists or not?


Comments