webR = {
const { WebR, ChannelType } = await import(
"https://cdn.jsdelivr.net/npm/webr/dist/webr.mjs"
);
const intWebR = new WebR({
channelType: ChannelType.PostMessage,
interactive: false
});
await intWebR.init();
await intWebR.installPackages(
["jsonlite", "dplyr", "scales", "ggplot2", "svglite"],
true
);
await intWebR.evalRVoid(`
library(dplyr)
library(ggplot2)
library(svglite)
`);
document.querySelector("#loader").innerText = "🟢";
document.querySelector("#msg").innerText = "WebR loaded!";
return intWebR;
}