我似乎无法downloadButton在 rmarkdown 文档中使用runtime: shiny. 这是一个与我正在做的类似的例子。
---
title: "R Document"
runtime: shiny
---
```{r, echo = FALSE}
numericInput("SS", "Selecr SS", min = 1, max = 100, value = 1)
RandomSample <- reactive({
data.frame(X = rnorm(100), Y = rnorm(100))
})
downloadButton("download", "Download")
renderPlot({
plot(RandomSample()[(1:input$SS), "X"], RandomSample()[(1:input$SS), "Y"])
})
renderTable({
RandomSample()[(1:input$SS),]
})
```
Run Code Online (Sandbox Code Playgroud)
我想要下载按钮来下载RandomSample(),但我什至无法downloadButton显示。
我正在尝试从此表中提取所有玩家链接:
https://www.footballdb.com/players/players.html?letter=A
这是我的代码的样子:
library(rvest)
url <- "https://www.footballdb.com/players/players.html?letter=A"
webpage <- read_html(url)
webpage %>%
html_nodes("table") %>%
html_attr("href")
Run Code Online (Sandbox Code Playgroud)
这将返回一个 NA。我看过其他有类似问题的帖子,但我未能很好地理解答案以将它们应用于这个问题。任何解决方案和/或指导将不胜感激。谢谢。