Dies ist eine lineare Regression auf mtcars Daten in R Studio. Ich versuche die App zu erstellen. Kein Glück. Tagelang daran arbeiten. Hilft nicht, dass ich neu in der Programmierung bin. Danke für die Hilfe.Shiny ui.r und server.r - Ich kann den Code nicht herausfinden, um die App zu funktionieren
Ist das richtig?
#server.r
data(mtcars)
mtdata<-mtcars
fit<-lm(mpg~cyl+hp+wt+qsec+am+gear,data=mtcars)
shinyServer(function(input, output) {
formulaText <- reactive({
#Not sure what this does.
paste("mpg ~", input$variable)
})
output$caption <- renderText({ # Not sure what this does.
formulaText()
})
# I am lost here. I think this part needs to 'mate up' with ui.r
output$mpgPlot <- renderPlot({
boxplot(as.formula(formulaText()), # I don't understand.
data = mtdata,
outline = input$outliers) # I don't understand.
})
})# I don't understand.
# ui.R
#fit<-lm(mpg~cyl+hp+wt+qsec+am+gear,data=mtcars)
shinyUI(fluidPage(
titlePanel("Guess which variables affect MPG!"),
# I understand sliders, radio buttons. There is a disconnect between ur
# and server.
fluidRow(
# I understand this.
column(3,
radioButtons("radio", label = h3("Cylinders"), # I understand.
choices = list("4 Cyl" = 4, "6 Cyl" =6, # I understand.
"8 Cyl" = 8),selected = 1)),
radioButtons("radio", label = h3("Number of Gears"),
choices = list("3" = 3, "4" =4,
"5" = 5),selected = 1),
#I understand this.
column(3,
selectInput("select", label = h3("Transmission Type"),
choices = list("Manual " = 1, "Automatic" =
2), selected = 1)),
fluidRow(
column(3,
sliderInput("slider1", label = h3("Horse Power"),
min = 52, max = 230, step = 5,value = 52),
sliderInput("slider2", label = h3("Weight, in tons"),
min = 1.513, max = 5.42,step = .1, value =
"min"),
sliderInput("slider3", label = h3("Quarter Mile, in
Seconds"),
min = 14.60, max = 22.90, step = .1, value
# I don't understand.
="min")), # I don't understand.
mainPanel( # I don't understand.
h3(textOutput("caption")), # I don't understand this.
plotOutput("mpgPlot") # I don't understand this.
) # I don't understand.
) # I don't understand.
) # I don't understand.
))
Können Sie Ihren ui.R-Code auch teilen? –
Hallo Raphael. Sowohl ui.r als auch server.r sind oben. Ich werde dich bezahlen, wenn du mir hilfst. Ich mache keine Witze. – xanstorm
Hast du die [sleeves - getting started] (http://shiny.rstudio.com/tutorial/) Lektionen durchlaufen? – SymbolixAU