O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding tab sets

Tabs are created by the tabPanel() function and each tab can hold its own output UI components. The TabApp folder has the ui.R and server.R files for a tabbed user interface. We give the main excerpts from each in the following code:

# Excerpt from ui.R  
mainPanel( 
      tabsetPanel( 
        tabPanel("Plot", textOutput("outputString"), 
                 plotOutput("plot")),  
        tabPanel("Summary", verbatimTextOutput("summary")),  
        tabPanel("Table", tableOutput("table")), 
        tabPanel("DataTable", dataTableOutput("datatable")) 
      ) 
    ) 

Add functionality to server.R to get the summary, table, and the data.table output:

 # Excerpt from server.R to generate a summary of the data output$summary <- renderPrint({ summary(auto) }) # Generate an HTML table view of the data output$table ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required