knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(wreportr) rmd_file = tempfile(fileext = "example3.rmd") main_dir = paste0(dirname(rmd_file), "/") dir.create(main_dir) write.csv(mtcars, file = paste0(main_dir, "alldata.csv")) vars = t(utils::combn(x = colnames(mtcars)[1:3], m = 2)) for(i in 1:nrow(vars)){ step_dir = paste0(main_dir, paste0(vars[i, ], collapse = "-"), "/") dir.create(step_dir) pdf(paste0(step_dir, "aplot.pdf")); plot(mtcars[, vars[i, ]]); dev.off() write.csv(mtcars[, vars[i, ]], file = paste0(step_dir, "atable.csv")) }
my_steps = list( metadata = list(table = paste0("'", main_dir, "alldata.csv'")) ) for(i in 1:nrow(vars)){ my_steps[[i + 1]] = paste0(main_dir, paste0(vars[i, ], collapse = "-"), "/") } # You can even add text as if you're dealing with latex my_steps[[2]] <- list(my_steps[[2]], title = "$\\checkmark$ Critical result") reportr = create_wsteps(my_steps) reportr = reportr_set_titles(reportr) report_render(reportr, output_file = "~/Documents/example3")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.