在按下操作按钮之前出现以下错误:
在推动// Extend your app underneath the status bar (Android 4.4+ only)
AndroidFullScreen.showUnderStatusBar(successFunction, errorFunction);
我缺少什么之后,一切都按预期工作?
Run Analysis!
答案 0 :(得分:0)
这就是诀窍:
## app.R ##
library(shiny)
library(shinydashboard)
library(dplyr)
library(arm)
library(texreg)
header <- dashboardHeader()
sidebar <- dashboardSidebar(column(3, actionButton(inputId = "go", label = "Run Analysis!")))
body <- dashboardBody(fluidPage(fluidRow(
box(
title = "Regression Table",
status = "primary",
solidHeader = TRUE,
width = 6,
uiOutput("mybayesglm")
)
)))
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output) {
results <- reactiveValues()
observeEvent(input$go, {
# Gen fake data
N<-1000
df1 <- data.frame(v1=sample(c(0,1),N,replace = T),
v2=sample(c(0,1),N,replace = T),
Treatment=sample(c("A", "B", "C"), N, replace = T),
noise=rnorm(N)) %>%
mutate(Y=0.5*v1-0.7*v2+2*I(Treatment=="B")+3*I(Treatment=="C")+noise)
# Run regression
mybayesglm <- bayesglm(data = df1, formula = Y~Treatment+v1+v2)
#ouput results in a reactive list
results[[as.character(length(names(results)) + 1)]] <- mybayesglm
return(results)
}) #<-end observeEvent
output$mybayesglm <- renderUI({
if(input$go==0)
return()
else
HTML(
htmlreg(reactiveValuesToList(results), ci.force = TRUE, ci.force.level = .95, caption = "")
)
})
}
shinyApp(ui, server)