Skip to content

Plotting multiple rpivotTable with for loop in html r-markdown #115

@KirchnerBenedikt

Description

@KirchnerBenedikt

I'm trying to generate a html report with Rmarkdown and want to include multiple rpivotTables. I have stored the input data.tables in a list, whose length can be varying according to the data I generate the report from, and I want to loop over every element in the list and print it in the html.

Any help would be greatly appreciated!

DT1 <- data.table(A= c(1,1,1), B= c(2,2,2))
DT2 <- data.table(C= c(3,3,3), D= c(4,4,4))
    
pivot_list <- list (DT1, DT2)

## This works and will include two rpivotTables in the html
rpivotTable(pivot_list[[1]])
rpivotTable(pivot_list[[2]])

## This doesn't work and won't include any tables in the html
for (i in 1:length(pivot_list)) {
      rpivotTable(pivot_list[[i]])
}

Thanks!

Benedikt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions