1
그래서 rCharts로 반짝이는 앱을 만들려고합니다. 아래의 코드를 실행하면 오류가 발생하지 않고 사이드 바 패널의 스크롤 막대가 표시되지만 막대 그래프 자체는 생성되지 않습니다. (R Studio에서 nPlot() 함수를 실행하면 잘 작동합니다.rCharts 및 Shiny - 플롯이 표시되지 않습니다.
server.R :
require(rCharts)
require(shiny)
# random data:
smpl<-data.frame(gene = c("gene1","gene2","gene3","gene4","gene5",
"gene6","gene7","gene8","gene9","gene10"),
direction = c("up","down","up","up","up",
"up","up","down","down","down"),
type = c("norm","norm","tum","tum","norm",
"tum","tum","norm","tum","tum"),
foldChange = c(1.3, 0.4, 1.3, 3.0, 1.6,
2.9, 1.3, 0.5, 0.5, 0.6))
shinyServer(function(input, output) {
output$myChart <- renderChart({
n <- subset(smpl, type == input$x)
p1 <- nPlot(foldChange ~ gene, group = "direction", n,
type = 'multiBarChart')
p1$set(dom = 'myChart')
return(p1)
})
})
ui.R
require(rCharts)
require(shiny)
shinyUI(pageWithSidebar(
headerPanel("Sample Bar Plot"),
sidebarPanel(
selectInput(inputId = "x",
label = "Select:",
choices = c("norm","tum"),
selected = "norm")
),
mainPanel(
showOutput("myChart", "polycharts")
)
))
필자는 '백금 $ 세트 (DOM = myChart)'선 및 'renderChart2'와 'renderChart'모두를 사용하여 시도 'pt $ set (dom = myChart)'행을 사용하지 않고 AND를 사용하지만 두 옵션 모두 작동하지 않습니다.
감사합니다.
하하, 오 와우. 내 자신이 멍청하게 느껴진다. 고맙습니다! –
도와 드리겠습니다. 쉬운 실수. – jdharrison
나는 같은 문제가 있지만 renderChart를 renderChart2로 변경했다. – huangli