Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在一个块中获取当前的块标签。这可能吗?
```{r my_chunk} gettextf("This chunk is called %s", some_function_to_get_chunk_label()) ```
您可以使用opts_current$get例如...
opts_current$get
opts_current$get(name = 'label')
例如
cat(knit(text =" ```{r 'hello'} render_markdown(strict=TRUE) opts_current$get(name = 'label') ``` "))
这使
render_markdown(strict = TRUE) opts_current$get(name = "label") ## [1] "hello"