我们如何在Shinyapp中复制具有不同属性名称的现有属性值?

问题描述

很高兴有人可以满足以下要求。

const storage = multer.memoryStorage()

const upload = multer({
    storage: storage
})
const FileType = require('file-type')

app.post('/uploadfile',upload.single('file'),async (req,res) => {
    console.log(Object.keys(req.file))
    console.log(await FileType.fromBuffer(req.file.buffer));
    res.send()
})    `

需求详细信息:-

想要将“类别/提供者”属性值的值连接到名为“ Category_provider”的新列下,不幸的是,它没有在UI表中显示属性名称,而是代替了这些值。为了达到要求,我的代码中将进行哪些更正。

enter image description here

解决方法

尝试一下,

url <-  "https://bbolker.github.io/mpha_2019/gapminder_index.csv"
dt <-   as.data.frame(fread(url))

# UI
ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
                textInput("newcolumnname","Custom Attribute Name"),selectInput("formula","Enter Custom Formula",choices = unique(names(dt)),multiple = TRUE),actionButton("addnewcolumn","Add new column")
            
                ),mainPanel(
      DT::DTOutput("data_tbl")

    )
  )
)
#SERVER
server <- function(input,output,session) {
  reactive_dt <- eventReactive(input$addnewcolumn,{
    if (input$newcolumnname != "" &&
        !is.null(input$newcolumnname) && input$addnewcolumn > 0) {

        newcol <- apply(dt[,input$formula],1,function(x) paste(x,collapse = "_"))

        cn <-colnames(dt)
        dt <<- data.frame(dt,newcol)
        colnames(dt) <- c(cn,input$newcolumnname)
    }
    dt
  })
  
  output$data_tbl <- DT::renderDT({ head(reactive_dt(),5) })
  }
#Run the Shiny App to Display Webpage


shinyApp(ui = ui,server = server) 

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...