Engine: R
library(dplyr)Engine: python
import pandas as pdRefer to chunk hooks for more information.
Engine: R
library(dplyr)Engine: python
import pandas as pdRefer to chunk hooks for more information.
| --- | |
| title: "Printing chunk engine via hook" | |
| output: github_document | |
| --- | |
| ```{r setup, include=FALSE} | |
| library(knitr) | |
| opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE) | |
| print_engine_hook <- function(before, options, envir) { | |
| if (before) { | |
| return(paste("**Engine**:", options$engine)) | |
| } | |
| } | |
| knit_hooks$set(print_engine_hook = print_engine_hook) | |
| opts_chunk$set(print_engine_hook = TRUE) | |
| ``` | |
| ```{r} | |
| library(dplyr) | |
| ``` | |
| ```{python} | |
| import pandas as pd | |
| ``` | |
| Refer to [chunk hooks](https://yihui.org/knitr/hooks/) for more information. |
Thanks to Yihui Xie for suggestions on how to improve the code.