Skip to content

Instantly share code, notes, and snippets.



Created Oct 11, 2013
What would you like to do?
The server part of my error-tracking Shiny app.
# Load the data from our CSV file
logfreq <- read.csv('portalserr.csv')
logfreq$date <- as.POSIXct(logfreq$date)
# Calculate error rate per thousand accesses
logfreq$perthou <- logfreq$error.count / logfreq$access.count * 10^3
shinyServer(function(input, output) {
output$freqPlot <- renderPlot({
if (is.null(input$errors_shown)) {
# If no checkboxes are checked, dislay an empty plot.
print(ggplot(data.frame(x=c(0),y=c(0))) + geom_point(aes(x,y), alpha=0))
} else {
lf.filtered <- subset(logfreq, %in% input$errors_shown)
p <- ggplot(lf.filtered) +
geom_point(aes(date, perthou,, size=3) +
geom_line(aes(date, perthou,,, size=2) +
expand_limits(ymin=0) +
theme(legend.position='left') +
ggtitle('Errors per thousand requests') +
ylab('Errors per thousand requests') +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.