Reputation: 509
When I go to run any R shiny application the first time it displays properly in the default R studio window. However if I go to run the code again I get a blank screen as shown below and I have to click "Open in Browser" to have it displayed properly. This happens no matter the complexity of the code even with something simple like the code below. The only way of fixing this is if I restart my R Studio entirely.
RStudio 2022.12.0+353 "Elsbeth Geranium" Release
(7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for Windows
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 2.2
year 2022
month 10
day 31
svn rev 83211
language R
version.string R version 4.2.2 (2022-10-31 ucrt)
nickname Innocent and Trusting
library("shiny")
ui <- fluidPage(
checkboxGroupInput(inputId="test", label="Test", choices=1:4, inline = TRUE)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
Upvotes: 6
Views: 1502
Reputation: 353
I was having the same problem using Rstudio version 2022.12.0. I updated all packages and also tried reverting back to R version 4.2.1 (I was using 4.2.2) but the problem remained.
I eventually fixed it by going back to RStudio 2022.07.02 (downloaded here) and it is currently working as normal with R 4.2.2. In conclusion, it looks like a bug in the latest (at time of writing) version of Rstudio.
Upvotes: 7
Reputation: 3002
You can use
shinyApp(ui = ui, server = server,options=c(launch.browser = .rs.invokeShinyPaneViewer))
to force shiny to always render in the viewer pane.
Upvotes: 5