Я делаю баррель с plotly на основе World Phones example.R: плоский и блестящий штрих-код
Боковая панельPanel не работает, можете ли вы сказать мне, почему?
data <- data.frame(x=rep(c('A','B','C'), each = 1, times = 3),
y=runif(9, 5, 10),
group=rep(c('2011','2012','2013'), each = 1, times= 3))
ui.R:
library(shiny)
library(plotly)
# Define the overall UI
shinyUI(
# Use a fluid Bootstrap layout
fluidPage(
# Give the page a title
titlePanel("Barchart"),
# Generate a row with a sidebar
sidebarLayout(
# Define the sidebar with one input
sidebarPanel(
selectInput("letter", "Letter:", levels(data[,1])),
hr()),
# Create a spot for the barplot
mainPanel(
plotlyOutput("dataPlot")
))))
server.R:
library(shiny)
library(plotly)
shinyServer(function(input, output) {
# Fill in the spot we created for a plot
output$dataPlot <- renderPlotly({
# Render a barplot
p <- plot_ly(data, x = input$letter, y=y, group=group,type = "bar")
p})
})
'вход $ letter' вернуться к вам' A' и у вас нет колунда 'A' в ваших данных – Batanichek