// r.jsimport { WebR } from'@r-wasm/webr'// `globalThis` is a browser hack to make certain type of// javascript objects available everywhere like the old days.// i.e., this can be accessed everywhere as "webR"globalThis.webR=newWebR();await globalThis.webR.init();exportconst webR = globalThis.webR;
Great Power
// main.jsimport'./r.js'// I kinda made a 😊 helper ƒ() to make calling R code from JS super 😌// We don't have 🕐 to go into to it today.const rDates =awaitR`seq.Date(as.Date("2018-01-02"), as.Date("2018-02-28"), "1 day") |> as.character()`console.log(rDates)
Then remember all the cool things you know how to do in R!
And, then consider what kind of lightweight and useful web apps you might be able to bring into the world when you don’t need to worry about a Shiny server being available.
And, then think about all the ways you can teach concepts in R to folks without needing a 💰☁️ server.