簡體   English   中英

如何在 R 的 Shiny 中設置方向 _sidebarPanel_?

[英]how setting orientation _sidebarPanel_ in Shiny in R?

我正在使用'''閃亮的'''。 但是當我運行 shiny 時,我的信息方向有問題。 ('''sidebarPanel''')。 當我運行我的代碼時,它會顯示一個垂直參數列。 所以太大了,看不到rest的信息。 我希望參數列是水平的,但我無法實現。

AedesIbag_model<-function(t, y, p) {
  with(as.list(c(y, p)), {
    dL = R*theta*S - mu_L*L - gamma_L*L - mu_w*L
    dP = gamma_L*L - mu_P*P  - gamma_P*P - mu_w*P
    dA = gamma_P*P - mu_A*A
    dD = beta - alpha*D
    list(c(L=dL, P=dP, A=dA, D=dD))
  })
}

server <- function(input, output) {
  output$AedesIbag_model <- renderPlot({
    y0 <- c(L=input$L, P=input$P, A=input$A, D=input$D)
    parms <- c(R=0.24, theta=input$theta,S=input$S,
               gamma_L=0.2088, gamma_P=0.384,
               beta=input$beta,
               mu_L=0.0105, mu_P=0.01041, mu_A=0.091,
               mu_w=input$mu_w,
               alpha=input$alpha)
    times <- seq(0, 100, 0.1)
    out_1 <- ode(y0, times, AedesIbag_model, parms)
    par(mfrow=c(2, 1))
    matplot.0D(out_1, main="time")
    plot(out_1[,2:3], type="l", xlab="L", ylab="D", main="state diagram")
  })
}


ui <- fluidPage(
  headerPanel("AedesIbag_model"),
  sidebarLayout(
    sidebarPanel(
      h3("Init values"),
      numericInput("L", label = "L",
                   min = 0.0, max = 2000,  value = 1000, step = 100, width=100),
      numericInput("P", label = "P",
                   min = 0.0, max = 1000,  value = 800, step = 10, width=100),
      numericInput("A", label = "A",
                   min = 0.0, max = 500,  value = 100, step = 10, width=100),
      numericInput("D", label = "D",
                   min = 0.0, max = 100,  value = 10, step = 5, width=100)
      ),
    fluidRow(
      column(
        h3("Parameters"),
        numericInput("R", label = "R",
                     min = 0.0, max = 1,  value = 2.4, step = 0.1, width=100),
        numericInput("theta", label = "theta",
                     min = 0.0, max = 5,  value = 3, step = 0.2, width=100),
        numericInput("S", label = "S",
                     min = 100, max = 5000, value = 1800, step = 100, width=100),
        numericInput("gamma_L", label = "gamma_L",
                     min = 0.2088, max = 0.2088, value = 0.2088, step = 0, width=100),
        numericInput("gamma_P", label = "gamma_P",
                     min = 0.384, max = 0.384, value = 0.384, step = 0, width=100),
        numericInput("beta", label = "beta",
                     min = 0.0, max = 1000, value = 10, step = 10, width=100),
        numericInput("mu_L", label = "mu_L",
                     min = 0.0105, max = 0.0105, value = 0.0105, step = 0, width=100),
        numericInput("mu_P", label = "mu_P",
                     min = 0.01041, max = 0.01041, value = 0.01041, step = 0, width=100),
        numericInput("mu_A", label = "mu_A",
                     min = 0.091, max = 0.091, value = 0.091, step = 0, width=100),
        numericInput("mu_w", label = "mu_w",
                     min = 0.0, max = 1, value = 0.1, step = 0.1, width=100),
        numericInput("alpha", label = "alpha",
                     min = 0.0, max = 1000, value = 10, step = 10, width=100)
        )
      )
    ),
  mainPanel(h3("Simulation results"),
            plotOutput("AedesIbag_model")
            )
  )


shinyApp(ui = ui, server = server)

```

也許您正在尋找這個:

ui <- fluidPage(
  headerPanel("AedesIbag_model"),
  sidebarLayout(
    sidebarPanel(
      h3("Init values"),
      numericInput("L", label = "L",
                   min = 0.0, max = 2000,  value = 1000, step = 100, width=100),
      numericInput("P", label = "P",
                   min = 0.0, max = 1000,  value = 800, step = 10, width=100),
      numericInput("A", label = "A",
                   min = 0.0, max = 500,  value = 100, step = 10, width=100),
      numericInput("D", label = "D",
                   min = 0.0, max = 100,  value = 10, step = 5, width=100)
    ),
    fluidRow(h3("Parameters"),
      column(2, numericInput("R", label = "R",
                              min = 0.0, max = 1,  value = 2.4, step = 0.1, width=100)
        ),
      column(2, numericInput("theta", label = "theta",
                              min = 0.0, max = 5,  value = 3, step = 0.2, width=100)
        ),
      column(2,numericInput("S", label = "S",
                             min = 100, max = 5000, value = 1800, step = 100, width=100)
        ),
      column(2, numericInput("gamma_L", label = "gamma_L",
                              min = 0.2088, max = 0.2088, value = 0.2088, step = 0, width=100)
        ),
      column(2, numericInput("gamma_P", label = "gamma_P",
                     min = 0.384, max = 0.384, value = 0.384, step = 0, width=100)
        ),
      column(2, numericInput("beta", label = "beta",
                     min = 0.0, max = 1000, value = 10, step = 10, width=100)
      ),
      column(2, numericInput("mu_L", label = "mu_L",
                     min = 0.0105, max = 0.0105, value = 0.0105, step = 0, width=100)
      ),
      column(2, numericInput("mu_P", label = "mu_P",
                     min = 0.01041, max = 0.01041, value = 0.01041, step = 0, width=100)
      ),
      column(2, numericInput("mu_A", label = "mu_A",
                     min = 0.091, max = 0.091, value = 0.091, step = 0, width=100)
      ),
      column(2, numericInput("mu_w", label = "mu_w",
                     min = 0.0, max = 1, value = 0.1, step = 0.1, width=100)
      ),
      column(2, numericInput("alpha", label = "alpha",
                     min = 0.0, max = 1000, value = 10, step = 10, width=100)
      )
    )
  ),
  mainPanel(h3("Simulation results"),
            plotOutput("AedesIbag_model")
  )
)

給出這個 output:

輸出

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM