Thanks for the time you have given. Almost 80 of the problem is solved.
I have modified your code a little bit. Actually let us say there are lots of functions in server.R. Do i have to name Obj <- ls()
everytime ? Please refer below section3
Also from your logic the output I get is below in section1
section1 below.
object_name object_class
InnerDF data.frame
Can we add another column and tell user that it is coming from myTable
as shown below is section2
section2 below. Expected output
object_name object_class output
InnerDF data.frame myTable
section3 below
library(shiny)
library(purrr)
asd2 <- function(a,b){
c <- a + b
return(c)
}
MyDF <- data.frame(A = 3)
MAT <- matrix(1:4, nrow = 2)
X <- 34
#Obj <- ls() #declared first time
ui <- pageWithSidebar(
headerPanel("My First Shiny App"),
sidebarPanel(
),
mainPanel(
tableOutput("myTable"),
tableOutput("myTable1")
)
)
server <- function(input, output, session){
#Obj <- ls()
output$myTable <-renderTable({
InnerDF <- data.frame(Z = 1:5)
Obj <- ls() #declared second time . Can we make this one time decalaration?
purrr::map_dfr(Obj,
~tibble(object_name = .,
object_class=class(get(.))[[1]]))
})
output$myTable1 <-renderTable({
InnerDF1 <- data.frame(Z = 1:32)
Obj <- ls()
purrr::map_dfr(Obj,
~tibble(object_name = .,
object_class=class(get(.))[[1]]))
})
}
# Run the application
shinyApp(ui = ui, server = server)