Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在knitr中引用当前块标签?_R_Knitr - Fatal编程技术网

如何在knitr中引用当前块标签?

如何在knitr中引用当前块标签?,r,knitr,R,Knitr,我想在块中获取当前块标签。这可能吗 ```{r my_chunk} gettextf("This chunk is called %s", some_function_to_get_chunk_label()) ``` 您可以使用选择当前$get例如 选择当前$get(name='label') 乙二醇 给 render_markdown(strict = TRUE) opts_current$get(name = "label") ## [1] "hello" 是否有一种方法可以自动将其

我想在块中获取当前块标签。这可能吗

```{r my_chunk}
gettextf("This chunk is called %s", some_function_to_get_chunk_label())
```

您可以使用
选择当前$get
例如

选择当前$get(name='label')

乙二醇

render_markdown(strict = TRUE)
opts_current$get(name = "label")

## [1] "hello"

是否有一种方法可以自动将其包含在每个块中?i、 每个区块打印自己的标签作为注释?
render_markdown(strict = TRUE)
opts_current$get(name = "label")

## [1] "hello"