Ike
March 16, 2019
This presentation is about a R Markdown and shiny application. The application used three shiny input elements textbox , selectInput and radio buttons
In each case, user is guided on what to do and what output to expect.
clusternum = 4
if (as.integer(clusternum) == 4) {
#Cluster with all 4 numeric variables
xvar4 <- iris[, -5]
y <- iris$Species
Kmean4 <- kmeans(xvar4, 3)
#Display classification table
table(y, Kmean4$cluster)
} ##
## y 1 2 3
## setosa 0 50 0
## versicolor 48 0 2
## virginica 14 0 36
With radio buttons, a user uses same plot to visualize data for state selected.
#Plot midwest data
gplot1 <- ggplot(data=midwest) +
geom_point(mapping = aes(x=percollege, y = percadultpoverty, color=state), alpha = 0.7) +
labs(
title = "Midwest: College Education Vs. Poverty Rates",
x = "Percentage of adults living in poverty",
y= "Percentage of adults with college education"
)
return(gplot1) With a textInput box. Whatever is entered gets dsiplayed.