【发布时间】:2018-04-18 20:29:10
【问题描述】:
我想知道是否可以在闪亮的 rmarkdown 中向用户隐藏一个元素并仍然获得响应值。
---
title: "My Title"
author: "My Name"
date: "Today"
output:
rmdformats::html_clean:
highlight: kate
runtime: shiny
---
```{r knitr_init, echo=FALSE, cache=FALSE}
library(knitr)
library(rmdformats)
## Global options
options(max.print="75")
opts_chunk$set(echo=FALSE,
cache=TRUE,
prompt=FALSE,
tidy=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
opts_knit$set(width=75)
```
```{r setup, include=FALSE}
library(tidyverse)
library(shinyjs)
```
```{r name, echo=FALSE, cache=FALSE}
inputPanel(
selectizeInput(inputId = "Name", label = "Choose Name", choices=c("Rachel","Mike"), selected="Mike"),
numericInput(inputId = "Cluster", label = "Choose Cluster", min = 1, max=10, value = 1 ,step = 1)
)
renderText(paste("Hallo:",input$Cluster))
```
我得到的是这个 rmarkdown:Picture 1
请参阅你好:1,显示的是,renderText 从 input$Cluster 获取响应值。是否有可能以某种方式隐藏这个 numericInput,它看起来像这样:Picture 2
我尝试过使用不同设置的 shinyjs,但效果不佳。
【问题讨论】:
标签: shiny r-markdown show-hide reactive