rk.exporter brings seamless, automated batch exporting capabilities to the RKWard GUI. Stop wasting hours manually exporting plots one by one or copy-pasting tables into Microsoft Office.
Powered by purrr, flextable, and officer, this plugin suite allows you to take a List of ggplot2 objects or flextables and instantly export them as hundreds of individual high-res files, or compile them directly into professional, multi-page Word documents, PDFs, or PowerPoint presentations.
This update brings critical bug fixes and hardens the core engine to ensure a smoother, error-free user experience:
ggplot or flextable into the target slot, the engine instantly detects it, wraps it, preserves its exact workspace name, and exports it smoothly as an individual file.This update focuses on better object serialization and a much cleaner user interface for naming strategies:
.rds files! This is incredibly useful for saving the pure R objects (either individually or as a combined list) to be loaded later into other R scripts, RMarkdown documents, or Shiny applications using readRDS().list(income = p1, age = p2)), it respects them (income.png, age.png). If the list is unnamed, it intelligently falls back to the workspace variable name and adds a sequence (e.g., my_graphs_1.png, my_graphs_2.png).This update introduces powerful new automation features for naming your exported files, making it easier to integrate the plugin into large-scale parameterized reporting workflows:
data.frame to automatically rename your exported files. Simply map a column with your internal R object names (Keys) to a column with your desired publication-ready file names (Values), and the plugin will handle the exact matching.ggplot or flextable), the plugin now automatically reads the name of the object directly from your R global environment (e.g., exporting p_demographics yields p_demographics.png instead of a generic plot_1.png).This is the initial release of the package, introducing two core automation tools for data reporting:
ggplot2 graphics. Choose between saving them as individual files (SVG, PNG, PDF) into a folder, or combining them into a single presentation/report (PPTX, DOCX, PDF).flextable objects. Output them as individual HTML/Word/PPTX files, or stack them perfectly into a single, paginated Word document or PowerPoint deck.The interface is fully localized in:
es)fr)de)pt_BR).docx), the plugin automatically injects page breaks (body_add_break()) so every table/plot sits cleanly on its own page.My Plot / 2 -> My_Plot___2.png) to prevent OS errors.lapply loop), the plugin will automatically generate sequential names (plot_1, plot_2, etc.)..docx or .pptx dynamically if you forget it.rk.XML.logic). Depending on whether you choose "Individual" or "Combined" modes, unnecessary fields grey out and become disabled, guiding you to a perfect export every time.This plugin is not yet on CRAN. To install it, use the remotes or devtools package in RKWard.
Open RKWard.
Run the following command in the R Console:
# If you don't have remotes installed:
# install.packages("remotes")
local({
require(remotes)
install_github("AlfCano/rk.exporter", force = TRUE)
})
Restart RKWard to load the new menu entries.
Once installed, the tools are located under the File menu:
File -> Batch Exporters
To test the suite, copy and paste this code into your RKWard console to instantly generate a list of ggplot2 graphics and a list of flextables:
library(ggplot2)
library(flextable)
# 1. Create a named list of ggplot2 objects
p1 <- ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) + geom_point(size=3) + theme_minimal() + labs(title="MTCars Scatter")
p2 <- ggplot(iris, aes(x = Species, y = Sepal.Length, fill=Species)) + geom_boxplot() + theme_minimal() + labs(title="Iris Boxplot")
my_plots <- list("Car_Analysis" = p1, "Flower_Analysis" = p2)
# 2. Create a named list of flextable objects
t1 <- flextable(head(mtcars[, 1:5])) %>% theme_vanilla() %>% set_caption("Motor Trend Cars")
t2 <- flextable(head(iris)) %>% theme_zebra() %>% set_caption("Edgar Anderson's Iris Data")
my_tables <- list("Cars_Table" = t1, "Iris_Table" = t2)
my_plots as your Target object.Report).my_tables.Cars_Table.docx and Iris_Table.docx perfectly exported in landscape mode.This plugin relies on the following R packages:
purrr (List iteration and mapping)ggplot2 (Graphics rendering and ggsave)svglite (High-quality SVG device rendering)flextable (Table formatting)officer (Native Microsoft Office document manipulation)rkwarddev (Plugin generation)