Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude row names from R Shiny renderTable

I am using the renderTable function from the R Shiny package and it is returning a table with row names. Ideally I want a table to be displayed with only two columns, one for 'Month' and one for 'Value'. The output I currently get includes the row names. I have tried a few things to exclude row names but was unsuccessful. Any thoughts?

output$valueTable <- renderTable({
if(input$table_view == TRUE){
  data.frame(Month = Month(), Value = valueData()[,"Value"])
}  
})
like image 741
rrbest Avatar asked Dec 18 '13 21:12

rrbest


People also ask

How do I exclude row names in R?

To remove the row names or column names from a matrix, we just need to set them to NULL, in this way all the names will be nullified.

How does row names work in R?

Row names are currently allowed to be integer or character, but for backwards compatibility (with R <= 2.4. 0) row. names will always return a character vector. (Use attr(x, "row.


2 Answers

this instruction is working for me

output$summaryTable <- renderTable({
       df()$donnees         
    }, 
    include.rownames=FALSE)
like image 79
Hazem HASAN Avatar answered Sep 19 '22 19:09

Hazem HASAN


Into your init code, put

options(xtable.include.rownames=F)
options(xtable.include.colnames=F)

this will disable it for all tables in your app.

like image 30
userJT Avatar answered Sep 22 '22 19:09

userJT