embedding csv into rshiny app for visualisation

# We'll save it in a variable `ui` so that we can preview it in the console
ui <- dashboardPage(
  dashboardHeader(title = "Row layout"),
  dashboardSidebar(),
 dashboardBody()
)


 server <- function(input, output) { 
  
driver.csv <- read.csv("E:/RMARKDOWN/driver.csv.csv", fileEncoding = "UTF-8")
  
  New_DataSet1<-data.frame(driver.csv$ï..Year_AG,driver.csv$Severity_Desc,driver.csv$Injury.Type)
  New_DataSet1
  
  latest <- New_DataSet1[1:100,]
  latest
  
  d <- aggregate(latest$driver.csv.Injury.Type,  by=list(chkID = latest$driver.csv.Severity_Desc), FUN=sum)
  #barplot(d)
  renderplot(d$x)
  #barplot(d$x, xlab = d$chkID)
 # barplot(d$x, names.arg = d$chkID)
  
 }
 
 shinyApp(ui,server)

You may need to look at the Shiny gallery to understand the basic structure of a shiny app.

You can also look at this example to start.

# Global variables can go here
n <- 200


# Define the UI
ui <- bootstrapPage(
  numericInput('n', 'Number of obs', n),
  plotOutput('plot')
)


# Define the server code
server <- function(input, output) {
  output$plot <- renderPlot({
    hist(runif(input$n))
  })
}

# Return a Shiny app object
shinyApp(ui = ui, server = server)
2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.