我file.Rmd用参数创建了一个RMarkdown文件。
我知道如何在r chunk而不是从中访问参数bash chunk
如果绝对没有办法,我将通过文件将参数写入文件r chunk,然后从bash chunk... 读取文件。
---
output: html_document
params:
myParam1:
label: "Choose 1st parameter"
value: 20
input: slider
min: 0
max: 100
myParam2:
label: "Choose 2nd parameter"
value: "Hello"
input: text
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, echo=FALSE}
print(paste("1st parameter :",params$myParam1))
print(paste("2nd parameter :",params$myParam2))
```
```{bash}
# Don't know how to get parameters here
echo $params
```
Run Code Online (Sandbox Code Playgroud)
谢谢
在可编辑的 DT 中按 TAB 后是否有编辑下一个单元格的技巧?
这将有助于更快地编辑整行。
下面是可编辑 DT 的基本示例。
library(shiny)
library(DT)
ui <- fluidPage(
DT::dataTableOutput('tbl1'),
verbatimTextOutput("print")
)
server <- function(input, output, session) {
data <- reactiveValues(x = iris[1:10,1:4])
output$tbl1 <- DT::renderDataTable({
DT::datatable(data = isolate(data$x), editable = TRUE, rownames = FALSE)
})
proxy_tbl1 <- dataTableProxy("tbl1")
observeEvent(input$tbl1_cell_edit, {
info = input$tbl1_cell_edit
i = info$row
j = info$col + 1
v = info$value
data$x[i, j] <- DT::coerceValue(v, data$x[i, j])
replaceData(proxy_tbl1, data$x, resetPaging = FALSE, rownames = FALSE)
})
output$print <- renderPrint({
print(data$x)
}) …Run Code Online (Sandbox Code Playgroud) 我想将我的myMardown.md文档包含在我的 Shiny 应用程序中。
为了显示目录,我使用了 toc 选项,我还使用了 css ( myStyle.css)
myMarkdown.md :
---
output:
html_document:
toc: true
toc_float: true
toc_depth: 2
css: myStyle.css
---
<div>
###A title using myStyle.css {.bigbaseline}
</div>
# Big chapter 1
## chapter A
## chapter B
# Big chapter 2
## chapter A
Run Code Online (Sandbox Code Playgroud)
myStyle.css
.bigbaseline {
font-size: 2em;
color: #134C89;
text-align: center;
font-style:italic;
}
Run Code Online (Sandbox Code Playgroud)
在 RStudio 中,当我预览 myMarkdown.md(使用pandoc)时,会显示目录,并且使用 css 的标题工作正常。
但恐怕当我使用 includeMarkdown 功能时, myMarkdown.md 文档的前端没有考虑在内。因为我看不到目录,也看不到带有 css 的标题。
app.R …