gpt4 book ai didi

r - 在 Shiny 应用程序启动时更改 RStudio 窗口的大小

转载 作者:行者123 更新时间:2023-12-03 13:40:22 25 4
gpt4 key购买 nike

我正在使用 RStudio IDE 开发 Shiny 的应用程序。启动应用程序时,我通常使用 RunApp 按钮:在窗口中运行。这将在具有特定宽度和高度的窗口中打开应用程序。

有没有办法改变这个窗口的宽度,所以每次我启动应用程序时都会在更宽的窗口中显示?

最佳答案

您可以尝试 runGadget 选项:

library(shiny)

ui <- fluidPage(
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(sliderInput(inputId = "bins", label = "Number of bins:", min = 1, max = 50, value = 30)),
mainPanel(plotOutput(outputId = "distPlot"))
)
)

server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")
})
}

# Run in a dialog within R Studio
runGadget(ui, server, viewer = dialogViewer("Dialog Title", width = 1200, height = 600))

# Run in Viewer pane
runGadget(ui, server, viewer = paneViewer(minHeight = 500))

# Run in browser
runGadget(ui, server, viewer = browserViewer(browser = getOption("browser")))

关于r - 在 Shiny 应用程序启动时更改 RStudio 窗口的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42491673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com