简体   繁体   中英

Use variable in Rmarkdown text

I am creating an Rmarkdown document.

My code chunk checks for the number of columns/rows in the dataset and saves the information in a variable.

{r, echo=FALSE, warning=FALSE}
df_dimenzions <- dim(demo)

I want to use the data/information stored in the variable in the rmarkdown text .

For example... outside of the code chunk, to write plain text such as:
The number of columns is {{df_dimensions[1]}} and the number of rows
is {{df_dimension[2]}}

Is something like this possible in rmarkdown? Again, I'm asking for data that is processed within the rmarkdown, not stored outside of the document?

Also, I am aware that I can paste a concatinated string with the code-chunk. That is not what I am trying to achieve.

在正文中使用`r df_dimensions[1]`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM