Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
闪亮的ui.r和server.r-I可以';I don’我想不出使应用程序工作的代码_R_Shiny - Fatal编程技术网

闪亮的ui.r和server.r-I可以';I don’我想不出使应用程序工作的代码

闪亮的ui.r和server.r-I可以';I don’我想不出使应用程序工作的代码,r,shiny,R,Shiny,这是mtcars Studio中mtcars数据集的线性回归。我正在尝试创建应用程序。不走运。为此工作了好几天。我是编程新手,这对我没有帮助。谢谢你的帮助 是这样吗 #server.r data(mtcars) mtdata<-mtcars fit<-lm(mpg~cyl+hp+wt+qsec+am+gear,data=mtcars) shinyServer(function(input, output) { formulaText <- reactive({

这是mtcars Studio中mtcars数据集的线性回归。我正在尝试创建应用程序。不走运。为此工作了好几天。我是编程新手,这对我没有帮助。谢谢你的帮助

是这样吗

#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.
    ))
#server.r
数据(mtcars)

mtdata未定义server.R期望从ui.R获得的某些输入(
input$variable
input$outliers
)。如果将以下控制器添加到ui.R,您将拥有一个运行良好的应用程序

radioButtons("variable", label=h3("Variable"),
             choices = list("Cylinders"="cyl",
                            "Gears"="gear",
                            "Transmission"="am",
                            "Horse Power"="hp",
                            "Weight, in tons"="wt",
                            "Quarter Mile, in seconds"="qsec"),
             selected="cyl"),
checkboxInput("outliers", "Show outliers", FALSE))

你也能分享你的ui.R代码吗?嗨,拉斐尔。ui.r和server.r都在上面。如果你帮我,我会付钱给你的。我不是开玩笑。你上过课了吗?如果你还没有找到答案,我可以在星期天帮你。如果你还需要帮助,请告诉我。拉斐尔-很抱歉延迟回复。几天后我需要帮助。有没有可能下午我,如果是这样,如何?如果你可以咨询,请让我知道。我希望有人能在我有问题时与我联系。我会支付你每小时或每件事。可以吗?我建议你去看看,那里有一些非常好的教程。我认为这将是一种更快的学习方法。与此同时,我对你的应用程序进行了一些自由的操作,创建了一个github存储库(),并尝试在其中添加一些解释性的注释。如果你有更多的问题,你可以把它们贴在这里。我会查出来并感谢你的帮助!!你做得太过分了。非常感谢。你可以咨询吗?我需要帮助。