I try to write an R-function which produces xtables in a loop. Later I want to call my function in a Sweave document- but a single chunk can't support multiple tables. I would have to put each table in a single chunk and wrap it with the Latex Code \begin{table} ... \end{table}. So I wonder, whether it's possible to somehow call Sweave/knitr from within the Loop of the R-function and add \begin{table} .. \end{table} around each xtable? Or whether it is somehow possible to send each xtable from the loop to a chunk with \begin{table} ... \end{table} environment?
A mini-example of my function:
multiple_tables_Loop<-function(...){
(....) ##Some necessary calculations to produce a data frame
for(j in 1:m){
for(i in 1:n){
a<-data.frame(...)
table<-xtable(a)
print(table)
}
}
}
In Sweave I would call the function:
<<Hallo_Table,results='aisis'>>
multiple_tables_Loop(...)
@