html - 在 RShiny 中访问 HTML 单选按钮值
问题描述
我无法从我的 Shiny 应用程序中的 HTML 单选按钮访问值,我非常感谢一些帮助。
这是我的 HTML 代码:
<!DOCTYPE html>
<head>
<script src="shared/jquery.js" type="text/javascript"></script>
<script src="shared/shiny.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="shared/shiny.css"/>
<link rel="stylesheet" href="nostylist.css"/>
</head>
<body>
<h1>HTML UI</h1>
<table>
<tr>
<th>Statement A</th>
<th>Agree much more with statement A</th>
<th>Agree somewhat more with statement A</th>
<th>Agree somewhat more with statement B</th>
<th>Agree much more with statement B</th>
<th>Statement B</th>
</tr>
<form>
<tr>
<td>I am particular about the food that I eat</td>
<td><input type="radio" name="row" value="1" checked></td>
<td><input type="radio" name="row" value="2"></td>
<td><input type="radio" name="row" value="3"></td>
<td><input type="radio" name="row" value="4"></td>
<td>I am not super-picky</td>
</tr>
</form>
</table>
<label>Number of observations:</label><br />
<input type="number" name="n" value="500" min="1" max="1000" />
<h3>Output:</h3>
<pre id="summary" class="shiny-text-output"></pre>
这是我的 RShiny 代码:
library(shiny)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$summary <- renderPrint(input$row)
}
# Run the application
shinyApp(ui = htmlTemplate("www/index.html"), server)
目前,输出的是“NULL”。但是,当我将 input$row 更改为 input$n 时,它引用了我的数字输入,我的数字输入的值得到了很好的输出。关于如何将单选按钮的选定值输出到我的 RShiny 应用程序的任何想法?
这是我的 Shiny 应用程序当前的样子: Shiny App
解决方案
推荐阅读
- mysql - SQL:从 Month_year 名称列中获取月份的开始日期
- python - 在逗号分隔的文本文件中查找一个字符,并返回它所属的字符串
- node.js - PM2 logrotation针对不同应用程序运行的不同配置
- javascript - 选择部分文本,就像我们使用 javascript 用鼠标选择一样
- javascript - 如何在 CFML [coldfusion] 中为 FORGOTTEN PASSWORD 字段提供电子邮件功能
- html - 我可以在脚本 src 属性中使用双版本键来避免浏览器缓存吗
- oracle - 如何在没有控制台的情况下在 WebLogic 服务器中更改 Stuck Thread Max Time 的值
- angular - 角度编译器和核心版本有什么区别?
- ios - 如果使用 (indexPath.item % n == 0) 显示单元格,则 UICollectionView 不会创建新单元格。它不会为数字的倍数创建新单元格
- python - python中的重复导入路径模式