plot_dist = function(df1, df2, features, nrows, ncols){
fig_list = list()
j=1
for (feature in features){
print(feature)
fig = ggplot()+
geom_density(data=df1,aes(feature),color="blue")+
geom_density(data=df2,aes(feature),color = "black")
fig_list[j] = list(fig)
j = j+1
}
multi_plot02 = marrangeGrob(grobs = fig_list, nrow = nrows, ncol = ncols)
return(multi_plot02)
}
where df1, df2 are two dataframes with features from var_0 to var_199 in both dataframes.
I have tried noquotes method also, but no luck. If I am running it as single code then it is working but not in loop
I'm getting this, in multiplot:
I expected this from the code, though it should be in multiplot: