You can change the column names inside of the renderTable function and not affect the names outside of that function
library(shiny)
library(data.table)
library(shinydashboard)
library(ggplot2)
DT <- data.table(A = LETTERS[1:4], B = 11:14)
ui <- dashboardPage(
dashboardHeader(title = "Test"),
dashboardSidebar(
),
dashboardBody(
tableOutput("Tbl"),
tableOutput("Tbl2"),
plotOutput("Plt")
)
)
server <- function(input, output, session) {
output$Tbl <- renderTable({
colnames(DT) <- c("NewA", "NewB")
DT
})
output$Tbl2 <- renderTable({
DT
})
output$Plt <- renderPlot({
ggplot(DT, aes(A, B)) + geom_point()
})
}
shinyApp(ui = ui, server = server)