私は棒グラフを表示する簡単なシャイニーAPPを開発しようとしています。私が従っている例(https://shiny.rstudio.com/gallery/telephones-by-region.html)では、プロットはPhone by Regionです。私はもっと簡単にしたい:候補者の数だけ(私のデータ:父親)。R Shiny Error with ggplot
主な問題は、バープロットコード内にinput
コマンドがあることです。
Don't know how to automatically pick scale for object of type tbl_df/tbl/data.frame. Defaulting to continuous. Warning: Error in : Discrete value supplied to continuous scale
データサンプル:
Candidato1 Candidato2 Candidato3
元barplot(WorldPhones[,input$region]*1000,
main=input$region,
ylab="Number of Telephones",
xlab="Year")
はこれを行う
ggplot(data=dados, aes(x=dados[input$candidato])) +
geom_bar(stat="count")
によって置換されなければならない、私はエラーを得ました3210
POSITIVO NEGATIVO POSITIVO POSITIVO
NEGATIVO POSITIVO NEGATIVO NEGATIVO
POSITIVO POSITIVO NEGATIVO NEGATIVO
どのように私はこの問題を解決することができますか? ggplotが私の文字列を受け入れることができないが、光沢のある外でうまく動作するように見える。
Tks、Ricardo。
あなたは 'input $ candidato'のどこに来たのかを説明する必要がありますか?あなたはそれで何をしたいですか?それは列名か列の値ですか? 'input $ candidato'が列のフィルター値を表す場合、列名は何ですか? –
おそらく 'ggplot(data = dados、aes_string(x = input $ candidato))+ geom_bar(stat =" count ")'のようなものが必要です。 'aes'の中で' $ 'を使わないでください。 – Axeman