ich eine glänzende app wie die folgende haben:Unterdrückungs plotly Warnungen in glänzenden app
server.R
:
shinyServer(function(input, output) {
output$trendPlot <- renderPlotly({
plot_ly(movies, x = length, y=rating, mode='markers', color=as.factor(year), colors = c("#132B43", "#56B1F7")) -> plott
plott
})
})
ui.R
:
Warning in RColorBrewer::brewer.pal(N, "Set2") :
n too large, allowed maximum for palette Set2 is 8
Returning the palette you asked for with that many colors
:
library(shiny)
library(plotly)
library(ggplot2movies) # Needed for the 'movies' data set
shinyUI(fluidPage(
titlePanel("Movie Ratings!"),
mainPanel(
plotlyOutput("trendPlot")
)
))
dies eine Warnung erzeugt
Ich möchte diese Warnung unterdrücken, weil sie meine Protokolle unnötig überlastet (ja, ich weiß, wie ich diese Warnung beheben kann, indem ich das Problem behebe. Dies dient jedoch nur der Veranschaulichung. In meiner wirklich glänzenden App gibt es keine Warnung mehr.
Einpacken der letzten plott
in renderPlotly()
in suppressWarnings()
funktioniert nicht. Das Ändern von plott
zu suppressWarnings(print(plott))
funktioniert funktioniert, aber druckt das Diagramm auch außerhalb des UI-Kontext. Kann das sauber gemacht werden?