我正在尝试为数据库(创建,读取,更新和删除)构建一个稍微复杂的CRUD接口(可能闪亮不是解决此问题的最佳工具,但由于我不熟悉js,因此我想尝试一下)。我已经找到了一些很好的例子,特别是Barbara的例子。现在,我正在寻找一种组合a selectizeInput和a 的快捷方式textInput(也许是selectize的选项?!),因为否则,如果我必须像下面的示例所示进行操作,那么我的代码就会变得很长。该示例将演示我想要得到的。(这不是我想要的。)
这是一个非常短的可重现示例:
library(shiny)
startData <- c("Berlin", "London", "Paris")
ui <- fluidPage(
selectizeInput("town", "Town", choices = c(startData, "new town")),
uiOutput("newTown")
)
server <- function(input, output, session) {
rV <- reactiveValues(towns = startData)
output$newTown <- renderUI({
if (input$town == "new town") {
tagList(
textInput("text", "New Town"),
actionButton("entry", "save town")
)
}
})
# update selectizeInput when actionButton is clicked
observeEvent(input$entry, {
rV$towns <- c(rV$towns, input$text)
updateSelectizeInput(
session, "town", "Town",
choices = c(rV$towns, "new …Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以在以ioslides_presentation呈现的R markdown文档的代码块中启用语法突出显示?在降价参考速查表中写到,YAML参数highlight不适用于滑坡。因此,我一直在寻找一种通过自定义的CSS文件启用语法突出显示的方法,但是由于我不熟悉CSS,因此我没有找到任何解决方案。
任何帮助,将不胜感激。这是一个简短的可复制示例:
---
title: "example"
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with R Output
```{r cars, echo = TRUE, eval = FALSE}
# cars' summary as an example for a comment
summary(cars)
# example for integers
cars[,1]
```
Run Code Online (Sandbox Code Playgroud)