如何在 R 中的 Shiny webapp 中创建 TextArea 作为输入? [英] How to create TextArea as input in a Shiny webapp in R?
本文介绍了如何在 R 中的 Shiny webapp 中创建 TextArea 作为输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建简单的 web 应用程序,我想在其中使用 HTML textarea 控件接收来自用户的多行输入.在 Shiny 中是否有任何开箱即用的方法来创建这样的输入控件?
I am trying to create simple webapp where I want to take in multiline input from user using HTML textarea control. Is there any out of the box way of creating such an input control in Shiny?
textInput 的帮助页面没有显示太多选项
Help page of textInput doesn't show much options
textInput {shiny} R Documentation
Create a text input control
Description
Create an input control for entry of unstructured text values
Usage
textInput(inputId, label, value = "")
Arguments
inputId
Input variable to assign the control's value to
label
Display label for the control
value
Initial value
Value
A text input control that can be added to a UI definition.
Examples
textInput("caption", "Caption:", "Data Summary")
推荐答案
您可以使用 tags
添加一个 textarea,它应该会被 Shiny 自动选取:
You can add a textarea using tags
and it should be picked up by Shiny automatically:
tags$textarea(id="foo", rows=3, cols=40, "Default value")
或者如果你更喜欢直接的 HTML,你也可以这样做
Or if you're more comfortable with straight HTML you can also do
HTML('<textarea id="foo" rows="3" cols="40">Default value</textarea>')
无论哪种情况,input$foo
都应该反映 textarea 的值.
In either case, input$foo
should reflect the textarea's value.
这篇关于如何在 R 中的 Shiny webapp 中创建 TextArea 作为输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文