samedi 21 novembre 2015

Conditionally rbind if data frame exists

I want to check if a data frame exists; if it does I will do an rbind and if not I want to do a "<-" operation. The code I tried (below) doesn't work.

ifelse(any(ls() %in% "df_a")
       , df_a <- rbind(df_a, df_b)
       , df_a <- df_b
       )

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire