I have a similar situation like this:
data1<-data.frame(a=c(1,2),b=c(3,4))
data2<-data.frame(a=c(5,6),b=c(7,8))
for(df in list(data1, data2)){
df[,"a"]<-as.character(df[,"a"])
}
mode(data1$a)
[1] "numeric"
I'm wondering why the loop failed to change the mode of the common variable a? and how to realize it?