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.
The idea is pretty simple, Markdown has a concept of reference links or reference-style links that allows us to define a value to a reference variable and then refer to that value later in the same document. This is my [random value] located somewhere in my Markdown document.
If you include an interactive element in a static output format, like a PDF, R Markdown will embed a screenshot of the element. Learn more about interactive documents with R Markdown at Interactive Documents.
Rmd file, you may now add text to your document. You may start with the most basic word processing—simply typing your text below the YAML header section. If you want to start a new paragraph, you can simply hit Enter twice on your key- board, and begin writing again.
RMarkdown is an extension to markdown which includes the ability to embed code chunks and several other extensions useful for writing technical reports. The rmarkdown package extends the knitr package to, in one step, allow conversion between an RMarkdown file (.Rmd) into PDF, HTML, word document, amongst others.
Use `r df_dimensions[1]`
in the main text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With