ui<-fluidPage(selectInput("variable","Variable:",c("Bedrooms"="bedrooms","Rooms"="rooms","Baths"="baths","Garage"="garage")),sidebarPanel(sliderInput("lotsize_value","Lot size (in thousands of square feet):",min=2.275,max=10,value=10,step=0.5),sliderInput("taxes_value","Enter taxes (in thousands of dollars):",min=3.891,max=10,value=10,step=0.5),sliderInput("livingspace_value","Enter max living space (in thousands square feet):",min=.975,max=2,value=2,step=0.1),sliderInput("fireplaces_value","Enter max fireplace:",min=0,max=1,value=1,step=1)),mainPanel(plotOutput("main_plot")))
library(MPV)library(shiny)library(ggplot2)sales<-table.b4names(sales)<-c("sale","taxes","baths","lotsize","livingspace","garage","rooms","bedrooms","homeage","fireplaces")attach(sales)server<-function(input,output){output$main_plot<-renderPlot({lotsize_f<-input$lotsize_valuetax_f<-input$taxes_valuelivingspace_f<-input$livingspace_valuefireplaces_f<-input$fireplaces_valuegraph_data<-subset(sales,lotsize<=lotsize_f&taxes<=tax_f&livingspace<=livingspace_f&fireplaces<=fireplaces_f,select=c("sale","taxes","lotsize","livingspace","garage","rooms","bedrooms","homeage","fireplaces","baths"))Variable<-factor(graph_data[[input$variable]])ggplot(graph_data,aes(x=homeage,y=sale,shape=Variable,color=Variable))+geom_point(size=6)+xlab("Age of Home (in years)")+ylab("Sale Price of House (in thousands of dollars)")+ggtitle(label="Sale Price of House vs. Age of House",subtitle="Source: table.b (MPV)")+xlim(0,70)+ylim(20,50)+theme(axis.text=element_text(size=15),axis.title=element_text(size=15,face="bold"),plot.title=element_text(color="black",size=17,face="bold"),plot.subtitle=element_text(color="black",size=15),legend.title=element_text(color="black",size=15),legend.text=element_text(color="black",size=15))})}