If we are looking to show the data.frame output use the renderDataTable from DT. For reproducibility, used the inbuilt dataset iris
library(shiny)
library(DT)
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny!"),
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
uiOutput("codePanel")
),
mainPanel(
DT::dataTableOutput("text")
)
)
)
server <- function(input, output) {
filt <- selectInput("codeInput",label ="choose code",
choices = as.list(unique(iris$Species)))
output$codePanel <- renderUI({ filt
})
dataset<-reactive({
subset(iris, Species == input$codeInput)
})
output$text<-renderDataTable(dataset())
}
shinyApp(ui = ui, server = server)
-output

The dataset rows can be pasted together to a string to be used in the renderText
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny!"),
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
uiOutput("codePanel")
),
mainPanel(
verbatimTextOutput("text")
)
)
)
server <- function(input, output) {
filt <- selectInput("codeInput",label ="choose code",
choices = as.list(unique(iris$Species)))
output$codePanel <- renderUI({ filt
})
iris$Species <- as.character(iris$Species)
dataset<-reactive({
do.call(paste, c(collapse = "\n", rbind(colnames(iris), subset(iris, Species == input$codeInput))))
})
output$text<-renderText(dataset())
}
shinyApp(ui = ui, server = server)
-output

Or use htmlOutput with renderUI
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny!"),
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
uiOutput("codePanel")
),
mainPanel(
htmlOutput("text")
)
)
)
server <- function(input, output) {
filt <- selectInput("codeInput",label ="choose code",
choices = as.list(unique(iris$Species)))
output$codePanel <- renderUI({ filt
})
dataset<-reactive({
do.call(paste, c(collapse = "<br/>", rbind(colnames(iris), subset(iris, Species == input$codeInput))))
})
output$text<-renderUI(HTML(dataset()))
}
shinyApp(ui = ui, server = server)
