I am attempting to write my first R Shiny app and am experiencing similar problem to those previously reported. In my case the application doesn't crash but just generates the error.
This is happening using R Studio under windows 10 and also under Win XP (identical results). I have slightly modified one of the gallery apps to demonstrate the problem. I have not been able to find any information on this particular problem even after quite a bit of searching and reading docs on debugging with R Studio and Shiny.
Attached are 2 screen dumps of the RStudio IDE showing the app working fine without a debug break point set and the error occurring when running once the break point is set. Below is the code I used to reproduce this error and the session version info from Windows 10.
ui.R
pageWithSidebar(
headerPanel('Iris k-means clustering'),
sidebarPanel(
selectInput('xcol', 'X Variable', names(iris)),
selectInput('ycol', 'Y Variable', names(iris),
selected=names(iris)[[2]]),
numericInput('clusters', 'Cluster count', 3,
min = 1, max = 9)
),
mainPanel(
plotOutput('plot1')
)
)
server.R
function(input, output, session) {
# Combine the selected variables into a new data frame
selectedData <- reactive({
iris[, c(input$xcol, input$ycol)]
})
clusters <- reactive({
kmeans(selectedData(), input$clusters)
})
output$plot1 <- renderPlot({
palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
"#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999"))
par(mar = c(5.1, 4.1, 0, 1))
# This bit of added code is just to test debugger/break point setting
numClusters <- input$clusters
print(paste("DEBUG Test", numClusters))
plot(selectedData(),
col = clusters()$cluster,
pch = 20, cex = 3)
points(clusters()$centers, pch = 4, cex = 4, lwd = 4)
})
}
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.14.2
[1] R6_2.2.0 htmltools_0.3.5 tools_3.3.2 Rcpp_0.12.8 jsonlite_1.1
[6] digest_0.6.10 xtable_1.8-2 httpuv_1.3.3 mime_0.5
>