hola
私は何かに立ち往生しています。私はggplot2 Shinyアプリケーションを作成しています。ここで、ユーザーは折れ線グラフに表示される変数の量を選択できます。複数の変数が選択されている場合、アプリケーションがクラッシュしたが、私はエラーを取得し、selectInputの引数の複数を使用:ggplotの光沢のあるアプリに可変量の線を表示する
library(shiny)
library(googlesheets)
library(reshape2)
library(ggplot2)
library(scales)
#google authorization, token storage, file acquiztion and assignment
myData_off <- melt(ridership_hour_off, id.vars = "time")
dat_off <- myData_off[myData_off$time != "Total",]
dat_off$time_ <- as.POSIXct(paste(dat_off$time), origin = "7:00 AM", format = "%I:%M %p", tz = "UTC")
dcast_off <- dcast(dat_off, time_~variable)
shinyServer(function(input, output, session) {
observe({
monthBy_off <- input$month
trick_off <- dcast_off[[monthBy_off]]
output$plot_off <- renderPlot({
O <-ggplot(data = data.frame(x = dcast_off$time_, y = trick_off), aes(x=x,y=y)) +
geom_line(size = 2, alpha = 0.75) +
geom_point(size =3, alpha = 0.75) +
ggtitle("Boarding the Bus Ridership December 2015") +
labs(x="Time",y="Count")+
theme(plot.title = element_text(family = "Trebuchet MS", color="#666666", face="bold", size=32, hjust=0.5)) +
theme(axis.title = element_text(family = "Trebuchet MS", color="#666666", face="bold", size=22))+
theme_classic()
O
})
})
})
UI:
Warning: Error in .subset2: subscript out of bounds
ここdata
サーバーは次のようになります。
library(shiny)
vars <- list("December" = "dec",
"January" = "jan",
"February" = "feb",
"March" = "mar",
"April" = "apr",
"May" = "may",
"June" = "jun",
"July" = "jul",
"August" = "aug",
"September" = "sep",
"October" = "oct",
"November" = "nov")
shinyUI(fluidPage(
headerPanel("Cross Acton Transit"),
titlePanel("Data Dashboard"),
# Your input selection
sidebarPanel(
selectInput("month", "Select plot", vars, selected = "apr", multiple = TRUE)
),
# Show the selected plot
mainPanel(
tabsetPanel(
tabPanel("Plot",
plotOutput("plot_off")
)
)
)
))
ありがとうございます
私の研究から、私は多分、私が代わりの観察反応性表現が必要だと思います。それらを交換することはできませんでした。 –
月ごとに異なる行のプロットが必要ですか? – aosmith
はい、私はグラフ上にあるかどうかを選択します。 –