Andrea Vallebueno
March 12, 2019
This Shiny App has been developed to enable the user to interact with US state-level data. Specifically, the user may select a variable from a list to explain variations in GDP per capita across states. In response to the user's selection, the Shiny App prints a linear model relating the two variables (GDP per capita and the user's selection as the regressor) and a plot of both variables, including the fitted line from the linear model.
The data used in the Shiny App is the R dataset state.x77, which includes the following variables:
Below is a glimpse of the dataset used in the app.
data <- state.x77
data <- as.data.frame(data)
names(data)<- c("Population", "Income", "Illiteracy", "Life.Expectancy", "Murder.rate", "High.school.graduates", "Frost", "Area")
head(data, 3)
Population Income Illiteracy Life.Expectancy Murder.rate
Alabama 3615 3624 2.1 69.05 15.1
Alaska 365 6315 1.5 69.31 11.3
Arizona 2212 4530 1.8 70.55 7.8
High.school.graduates Frost Area
Alabama 41.3 20 50708
Alaska 66.7 152 566432
Arizona 58.1 15 113417
Below is an example of the output produced by the Shiny App stemming from the selection of Life Expectancy as the regressor. Note that linear model output has been cut for formatting purposes.
lm(formula = Income ~ Life.Expectancy, data = data)
(Intercept) Life.Expectancy
-6603.4829 155.7492