Надеюсь, что кто-то может помочь!
Я пытаюсь создать блестящее приложение R, которое позволит мне загружать файл, а также отображать графики на разных вкладках. Мой код для загрузки файла работает, когда я не представляю вкладки - не уверен, почему это повлияет на что-либо.
Мне тоже не удается отобразить свой ggplot, хотя код работает за пределами блестящего приложения.
Вот мой текущий код (я знаю, что у меня есть виджеты, которые не сделать что-нибудь еще ...):
ui <- fluidPage(
# Application title
titlePanel(h1("Title", align = "center")),
# Upload file
fileInput("upload", "Data file:", buttonLabel = "Select File", multiple = FALSE),
tableOutput("files"),
hr(),
# Tabs for Display Options
tabsetPanel(
tabPanel("Table 1", tableOutput("table")),
tabPanel("Plot1", plotOutput("distPlot")),
tabPanel("Table 2", tableOutput("table")),
tabPanel("Plot 2",plotOutput("distPlot")),
tabPanel("Summary", verbatimTextOutput("summary"))
),
# Sidebar with interactive widgets
sidebarLayout(
sidebarPanel(
# Radio Buttons for Data Normalization
radioButtons("radio", label = h3("Pick:"),
choices = list("1" = 1, "1" = 2), selected = 1),
hr(),
# Checkbox for whether outliers should be included
checkboxInput("outliers", "Show outliers", FALSE)
),
mainPanel(
h1("test...")
)
)
)
# Server
server <- function(input, output) {
# You can access the value of the widget with input$file
output$files <- renderTable(input$upload)
# Distribution Plots
output$distPlot <- renderPlot({
p <- ggplot(data=dat, aes(column1)) + geom_density(aes(y = ..count..), fill = "lightgray")
print(p)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Dat - это просто фрейм данных с 104 значениями в каждом из 2 столбцов (один с именем "column1"). Не уверен, как поделиться этим здесь, но может быть что угодно, если я смогу показать это.
Спасибо !!