lundi 2 juillet 2018

IF a table does not exist, skip in for loop in R

I have series of mysql tables in R as follows. Of the tables, some are missing.

     Name
        A
        B
        C
        D

namelist<-Name

I have created a function. I have used mapply to run the function across the list

 Y<-function(x){summary(x)}
 A<-mapply(Name, Y)

This throws an error as follows

Table B doesn't exist

I have a hundred tables in the list of tables. It is manually impossible to determine all the missing tables. Is there a way to skip over the missing tables using an if statement.

Aucun commentaire:

Enregistrer un commentaire