【发布时间】:2020-04-01 18:54:13
【问题描述】:
我在应用程序中遇到的问题很少。这是我 add 和加载 csv 文件的代码。但是有一些问题,我也需要一些东西。请求任何人帮助我
问题:
1)我无法加载第二个文件。不知道为什么?
2) 我也添加了删除按钮,因此一旦单击Remove 按钮,相应的文件就会被卸载。
3)我们可以创建另一个输出,当加载新文件时,它应该显示前15行head(df, n = 6)
---
title: "Untitled"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(rhandsontable)
```
Column {data-width=650}
-----------------------------------------------------------------------
```{r}
actionButton("add", "Add UI",width = 100)
observeEvent(input$add, {
insertUI(
selector = "#add",
where = "afterEnd",
ui = fileInput("file1", "Choose CSV File", accept = c( "text/csv", "text/comma-separated-values,text/plain", ".csv"))
,multiple = FALSE
)
insertUI(
selector = "#add",
where = "afterEnd",
ui = actionButton("V","Remove",width = 100))
})
observeEvent(input$V,{
removeUI(selector = '#file1')
})
```
【问题讨论】:
-
这可能有助于
removeUIstackoverflow.com/questions/42548083/… -
我试过但没有工作。我已经编辑了我的问题。此外,还有其他问题。像 1) 我无法加载第二个文件。不知道为什么? 2)我们可以创建另一个输出,当加载新文件时,它应该显示前 15 行 head(df, n = 6)。请帮忙