我正在使用 R Shiny 开发预测模型。
我输入了模型的一些变量,例如性别、年龄、身高......然后我有一个操作按钮,上面写着“生成预测”。
按下时,会根据输入变量的预测出现一些文本和图形。
我还添加了一个“重置”操作按钮。
我希望当按下此按钮时所有变量都变为原始值(已经有效)并且“生成预测”按钮后生成的输出消失。
我的问题是这个愿望的第二部分。
是否可能以及如何在按“重置”后删除输出?
下面以我的脚本为例(真实的脚本更复杂)。我希望在按下重置时“预测结果”中的部分消失。
library(shiny)
# Define UI ----
ui <- fluidPage(
titlePanel(title=div( "COPD risk prediction tool")),
p("Chronic Obstructive Pulmonary Disease (COPD) is a lung problem that can affect people mainly as they get older. One of the main features of COPD is a change in the airways that alters how the air is held in the lungs and the ease with which breathing occurs (the airways become 'obstructed'). This may cause breathlessness, …Run Code Online (Sandbox Code Playgroud)