To use your own data instead of the hard-coded demo data frames, you’ll need to tweak the app.R code. I did it by loading my own data sets at the top of app.R and then changing the first line of code in this block to be my data sets instead of mpg, diamonds, economics, iris, and mtcars.
for (dataset in c("mpg", "diamonds", "economics", "iris", "mtcars")) {
df <- eval(parse(text = dataset))
if (is.data.frame(df)) {
samples <- c(
samples,
paste0(
"## ",
dataset,
"\n\n",
capture.output(write.csv(head(df), "")),
collapse = "\n"
)
)
}
}
After those steps, your app should be ready to go. Click the Run button in the app.R file if you’re in RStudio or Positron, or run shiny::runApp("app.R")
in an R console. Again you’ll need to make sure to open the app in a full-fledged browser instead of an IDE viewer pane.
As of last month’s positconf conference, shinyrealtime was “a tool that we’ve spent maybe six hours collectively on,” Wickham said. More time has been invested in it since, but it’s still in early stages for now. Nevertheless, these apps give R users a glimpse of what could be the next step in merging generative AI with Shiny: web apps that understand your spoken commands and speak back.