여기 내 샘플 데이터가 있습니다. 내 페이지에 반응 형 플롯을 표시하기 위해 반짝이는 앱을 쓰고 싶지만 그 중에 뭔가 잘못되었습니다. 내가 막대 차트에서 x 축을 선택하면 막 대형 차트의 X 축이 Rshiny에서 업데이트되지 않습니다
그리고 내 질문은 업데이트되지 않습니다 반짝에 플롯하지만, y 축 내가 어디 있는지 알고하지 않습니다 때문에 업데이트 할 수 있습니다하면 문제 방법입니다 이 문제를 해결 하시겠습니까?ui.R
library(shiny)
library(dplyr)
library(ggplot2)
#Data Input#
Sample <- read.table("D:/Sample.csv", sep = ",", header = T) %>%
subset(., select = c(2, 3, 4, 5, 6))
#Data Manipulation#
Sample[, c(3:5)] <- sapply(Sample[, c(3:5)], as.factor)
Catego.x <- colnames(Sample[, 3:5])
Catego.y <- colnames(Sample[, 3:5])
Conti <- colnames(Sample[, 1:2])
#ui.R#
shinyUI(navbarPage(
"Recommendation System",
navbarMenu(
"Plot",
tabPanel("Boxplot",
sidebarPanel(
selectInput(inputId = "Conti",
label = "Continuous Variables:",
choices = Conti),
selectInput(inputId = "Catego.x",
label = "Categories Variables:",
choices = Catego.x)
),
mainPanel(
plotOutput("boxplot")
)),
tabPanel("Barchart",
sidebarPanel(
selectInput(inputId = "Catego.x",
label = "Categories Variables.x:",
choices = Catego.x),
selectInput(inputId = "Catego.y",
label = "Categories Variables.y:",
choices = Catego.y)
),
mainPanel(
plotOutput("barchart")
))
)
))
server.R
library(shiny)
#Data Input#
Sample <- read.table("D:/Sample.csv", sep = ",", header = T) %>%
subset(., select = c(2, 3, 4, 5, 6))
#Data Manipulation#
Sample[, c(3:5)] <- sapply(Sample[, c(3:5)], as.factor)
Catego.x <- colnames(Sample[, 3:5])
Catego.y <- colnames(Sample[, 3:5])
Conti <- colnames(Sample[, 1:2])
#server.R#
shinyServer(function(input, output){
output$boxplot <- renderPlot({
ggplot(data = Sample, aes_string(x = input$Catego.x, y = input$Conti, group = input$Catego.x)) +
geom_boxplot()
})
output$barchart <- renderPlot({
ggplot(data = Sample, aes_string(x = input$Catego.x, y = input$Catego.y, fill = input$Catego.y)) +
geom_bar(stat = "identity")
})
})
데이터의 dput()을 게시 할 수 있습니까? 그렇지 않으면 문제를 재현 할 수 없습니다. – Barbara