Dear colleagues,
I am working on a shiny app in which I am attempting to accept a CSV upload from the user and then create a ggplot from the uploaded file.
Here is a reprex of my UI logic:
tabPanel("Upload",
sidebarLayout(
sidebarPanel(
fileInput("file1", "Choose CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
tags$hr(),
checkboxInput("header", "Header", TRUE)
),
mainPanel(
tableOutput("contents"),plotOutput("upload"),
)
)
)
#> Error in tabPanel("Upload", sidebarLayout(sidebarPanel(fileInput("file1", : could not find function "tabPanel"
Server logic:
output$contents <- renderTable({
inFile <- input$filedata
if (is.null(inFile))
return(NULL)
})
#> Error in renderTable({: could not find function "renderTable"
#> Error in renderTable({: could not find function "renderTable"
output$upload <- renderPlot({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
uploadr<-read.csv(inFile$datapath, header = input$header)
uploadr %>%
ggplot(aes(x=Product, y=Stock))+geom_col()
})
#> Error in renderPlot({: could not find function "renderPlot"
#> Error in renderPlot({: could not find function "renderPlot"
Any ideas on what's going wrong here? My app is currently returning the error message: duplicate 'row.names' are not allowed.
Thank you for your help in advance. I've been stuck on this for quite some time, so any insight would be greatly appreciated.