I am trying to create a list of tables created by output of function. i have tried many ways but not working.
df <-
mtcars[1:8,4:ncol(mtcars)] %>%
rownames_to_column(var = "model")
df1 <- subset(df, vs==1)
df2 <- subset(df, am==1)
df3 <- subset(df, gear==3)
df_list <- list(df1,df2,df3)
banner <- c("T1","T2","T3")
func1<-function(df,list_var,....){
table_list<-list()
for (i in 1:length(df_list)) {
table_list[[i]]<-sub_fun(df, list_var[i])
t1 <- do.call(rbind,table_list)
# this sub function is creating a frequency table for multiple columns
# t1 is a table here and this loop create table like t1, t2 , t3
}
colnames(t1)[1] <- banner[[d]]
# here i am changing the name of first row of table like "T1"
# my question is here i want to create a list of tables and convert them #into a single data frame of list of dataframes above
table_list1[i] <- t1
t2 <- t2 <- Reduce(bind_rows, table_list1)
t2
}
the output should be like a single data frame with one blank row between them. so for example if function produces three tables then output should be like three dataframes, one below another and that will become single dataframe final.