R studio, shiny app questions

0 comments

4 questions about make a shiny app in R studio.

instructions

Create three Apps in the appropriate folders in the homework repo in accordance with the instructions below.

    1 .Create a Shiny app based on the mpg dataset from the ggplot2 package.

  • Allow a user to select three variables from the dataset.
  • The app should output a scatterplot of two of the variables and color code the points by the third variable.
  • Make the default variables the ones in the image below.
    • 3.Researchers were interested in predicting residential home sales prices in a Midwestern city as a function of various characteristics of the home and surrounding property. Data on 522 transactions were obtained for home sales during the year 2002. The 13 variables are:

    • Price: Sales price of residence (in dollars)
    • Area: Finished area of residence (in square feet)
    • Bed: Total number of bedrooms in residence
    • Bath: Total number of bathrooms in residence
    • AC: 1 = presence of air conditioning, 0 = absence of air conditioning
    • Garage: Number of cars that a garage will hold
    • Pool: 1 = presence of a pool, 0 = absence of a pool
    • Year: Year property was originally constructed
    • Quality: Index for quality of construction. High, Medium, or Low.
    • Style: Categorical variable indicating architectural style
    • Lot: Lot size (in square feet)
    • Highway: 1 = highway adjacent, 0 = highway not adjacent.

    We’ve seen these data a few times before.

    3.1 Build a Shiny App with the following attributes:

    1. Three tabs. The first tab is for univariate analysis. The second tab is for bivariate analysis. The third tab is for a spreadsheet of the numeric variables in the data.
    2. The inputs/outputs for the univariate analysis should be:
    • The variable of interest.
    • Do the analysis on the log scale or not?
    • The number of bins in the histogram.
    • The null value for a one-sample t-test.
    • Output the results of the one-sample t-test. The results of the test should be done on the log or non-log scale according to the user options.
    • Output a histogram if the variable is numeric and a barplot otherwise.
    1. The inputs/outputs for the bivariate analysis should be:
    • The two variables of interest.
    • Whether to log each variable. Only numeric variables should be logged.
    • Whether to add an OLS line.
    • Output a scatter plot if both variables are numeric, a boxplot if one is numeric and one is categorical, and a jitter plot if both are categorical.
    1. The spreadsheet tab should contain a Data Table with only the numeric variables. Use a map*() function to select these.
    2. Try to make your Shiny app as visually similar to my app as you can.
    • Hint: You can make this a lot easier by taking advantage of the modularity built into ggplot2:
    • Hint: I found it easier to use geom_boxploth() from the ggstance library instead of using coord_flip().
    • Hint: Think carefully about which variables should be treated as categorical and which should be treated as quantitative. Transform as appropriate when you load the data.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}