User247365
User247365

Reputation: 685

DT don't display first x number of rows

I am looking to hide the first 3 rows in my list when it gets displayed in a shiny application. To be clear, I do not want to remove these entries from the list, just not display them. Is this possible within the renderDataTable function? I have provided a simple sample code to display a DT table in a shiny app using the iris data.

  library(shiny)
  library(DT)

  df <- iris

  ui <- fluidPage(
    DT::dataTableOutput("projectsTable")
  )


  server<-function(input,output,session)
  {
    output$projectsTable <- DT::renderDataTable({iris})
  }

  shinyApp(ui=ui, server=server)

Upvotes: 0

Views: 204

Answers (1)

Alex Dometrius
Alex Dometrius

Reputation: 820

If I understand your question correctly:

df <- iris

ui <- fluidPage(
  DT::dataTableOutput("projectsTable")
)

server<-function(input,output,session)
{
  output$projectsTable <- DT::renderDataTable({iris[4:150,]})
}

shinyApp(ui=ui, server=server)

Additionally,

iris[c(-1,-2,-3),]

Upvotes: 1

Related Questions