を光沢のあるダッシュボードにプロットして統合していて、条件文を使用しているときにエラーが発生した場合、クラス「NULL」のオブジェクトに適用される 'plotly_build'の適用可能なメソッドがありません。 selectInputでif文を使ってチャートを切り替えようとしています。私はこれをcirclizeパッケージとggplotグラフで問題なく使用しましたが、プロットして使用しようとすると、次のエラーが発生します。ggplotlyステートメント
UseMethodのエラー: 'plotly_build' NULL」
私は同様の問題で、ここでの投稿を見つけましたが、まさに私の具体的な質問に答えるではない。ここで
Convert ggplot object to plotly in shiny application
を上記の投稿ではなくて使用されるものに類似したコードを使用したサンプルであります私が何を探しているのか、ポップを維持するエラーを表示するための変更pingがアップ:
library(shiny)
library(ggplot2)
library(ggthemes)
library(plotly)
ui = dashboardPage(
dashboardHeader(title = 'sample'),
dashboardSidebar(), ##Body content dashboardBody(
fluidRow(
box(background = "green", selectInput(inputId = "dimension",
label = strong("Choose Metric"),
choices = c('choice' = '1', 'choice2' = '2'),
multiple = FALSE, selectize = TRUE)),
box(plotlyOutput(outputId = 'plot2')))
))
server < - function(input, output) {
output$plot2 < -renderPlotly({
print(
ggplotly(
ggplot(data = mtcars, aes(x = disp, y = cyl)) + geom_smooth(method =
lm, formula = y~x) + geom_point() + theme_gdocs()))
if (input$dimension == '2') {
print(
ggplotly(
ggplot(data = mtcars, aes(x = hp, y = cyl)) + geom_smooth(method =
lm, formula = y~x) + geom_point() + theme_gdocs()))
}
})
}
shinyApp(ui, server)
私はまだ私はこの私をエスケープし、単純なエラーと確信しているので、学んでいるが、私はそれが何であるかわかりませんよ。助けを感謝します!
これは完璧で、魅力的なように機能しました。大幅に助けを感謝します! – LoF10