R:如何计算数据集名称以打印数据集
我想在R Shining web app中打印数据集值。但下面的代码正在UI输出中打印数据集的名称。如何打印数据集的值R:如何计算数据集名称以打印数据集,r,shiny,R,Shiny,我想在R Shining web app中打印数据集值。但下面的代码正在UI输出中打印数据集的名称。如何打印数据集的值 library(MASS) library(shinythemes) library(shiny) library(ggplot2) mass.tmp <- data(package = "MASS")[3] mass.datasets <- as.vector(mass.tmp$results[,3]) ui <- fluidPage( theme
library(MASS)
library(shinythemes)
library(shiny)
library(ggplot2)
mass.tmp <- data(package = "MASS")[3]
mass.datasets <- as.vector(mass.tmp$results[,3])
ui <- fluidPage(
theme = shinytheme("superhero"),
titlePanel("Linear Regression Modelling"),
sidebarLayout(
sidebarPanel(
selectInput("dsname", "Dataset:",choices = c(mass.datasets))
,
uiOutput("x_axis")
,
tableOutput("tab")
),
mainPanel(
tags$br(),
tags$br()
)
)
)
server <- function(input, output) {
num_ds <- function(ds)
{
nums <- sapply(ds,is.numeric)
num_ds <- ds[,nums]
return(num_ds)
}
ds_ext <- reactive({ num_ds(input$dsname) })
output$tab <- renderTable({ eval(input$dsname) })
# output$x_axis <- renderUI({
# col_opts <- get(ds_ext())
# selectInput("x_axis2", "Independent Variable:", choices = names(col_opts))
# })
}
shinyApp(ui = ui, server = server)
库(MASS)
图书馆(shinythemes)
图书馆(闪亮)
图书馆(GG2)
mass.tmp您是否尝试过不使用eval()调用?如果您的数据位于环境output$选项卡中,请尝试查找?get