问题
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"])
}
})
回答1:
this instruction is working for me
output$summaryTable <- renderTable({
df()$donnees
},
include.rownames=FALSE)
回答2:
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.
回答3:
I think you need to include row.names=NULL
inside your data.frame call.
data.frame(Month = Month(), Value = valueData()[,"Value"], row.names=NULL)
If you already have a data frame(df), then you could do: row.names(myDF) <- NULL
回答4:
This will work
output$valueTable <- renderTable({
if(input$table_view == TRUE){
data.frame(Month = Month(), Value = valueData()[,"Value"])
}
}, rownames = FALSE)
来源:https://stackoverflow.com/questions/20669150/exclude-row-names-from-r-shiny-rendertable