R Markdown with Shiny Presentation

Ike

March 16, 2019

Introduction

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.

SelectInput with Old Faithful Data

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

Radio button with midwest data

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)   

Demonstration of a textInput widget

With a textInput box. Whatever is entered gets dsiplayed.