I have to bind/merge dataframes in an iterative process in R. In occasions, some of the dataframes might not exist for reasons I will not explain here. I would like to know how I could bind dataframes even when calling some dataframe that does not exist. As an example, I have these dataframes:
df.R_H <- data.frame(A=c(0,4,5,6,7),
B=c(3,9,4,5,8),
C=c(1,2,4,2,6))
df.B_C <- data.frame(A=c(0,4,5,6,7),
B=c(3,9,4,5,8),
C=c(1,2,4,2,6))
df.G_H <- data.frame(A=c(0,4,5,6,7),
B=c(3,9,4,5,8),
C=c(1,2,4,2,6))
However, in my code I have this:
df5 <- rbind(df.R_H,df.B_C,df.G_H,df.R_C)
df5
How can I bind dataframes although df.R_C does not exist? I can not check individually which dataframes exists or not since I have hundreds of situations like this and I want to do it automatically even when some dataframe does not exist.