- Suppose that you want to create a quick interactive graphic
- You have to do it now
- The intended users also use Rstudio
manipulateis a really cool solution that is often all you need to quickly make interactive graphics
Brian Caffo, Jeff Leek, Roger Peng
Johns Hopkins Bloomberg School of Public Health
manipulate is a really cool solution that is often all you need to quickly make interactive graphics
library(manipulate)
manipulate(plot(1:x), x = slider(1, 100))
library(manipulate)
myHist <- function(mu){
hist(galton$child,col="blue",breaks=100)
lines(c(mu, mu), c(0, 150),col="red",lwd=5)
mse <- mean((galton$child - mu)^2)
text(63, 150, paste("mu = ", mu))
text(63, 140, paste("MSE = ", round(mse, 2)))
}
manipulate(myHist(mu), mu = slider(62, 74, step = 0.5))