Using a loop in R, I generated 100 random datasets and made a plot for each of these 100 datasets:
library(ggplot2)
results = list()
for (i in 1:100)
{
my_data_i = data.frame(var_1 = rnorm(100,10,10), var_2 = rnorm(100,10,10))
plot_i = ggplot(my_data_i, aes(x=var_1, y=var_2)) + geom_point() + ggtitle(paste0("graph", i))
results[[i]] = plot_i
}
list2env(setNames(results,paste0("plot",seq(results))),envir = .GlobalEnv)
What I am now trying to do, is make a Rmarkdown/flexdashboard that can be saved as an HTML file, and:
- Contains all these plots
- Allows the user to search for these plots (e.g. type in "plot76")
In a previous question (How to create a dropdown menu in flexdashboard?) I learned how to do something similar.
But I am still trying to figure out how I can get something like this to work. I would like there to be a single page with a search bar, and you can type in which graph you want to see.
Can someone please help me out with this? Are there any online tutorials that someone could recommend?
Thank you!