Thanks for sharing! small changes were made to the syntax apparently, this variant worked:

library("shiny")
library("datasets")
library("ggplot2")

# We tweak the "am" field to have nicer factor labels. Since this doesn't
# rely on any user inputs we can do this once at startup and then use the
# value throughout the lifetime of the application
mpgData <- mtcars
mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))