I'm using knitr to embed R code within a markdown (.Rmd) file. I'm converting the file to a PDF file with Pandoc. The contents of my .Rmd file looks like this:
Report
========================================================
This is my report. Some analysis is included in LINK TO CHUNK NAMED MY.ANALYSIS HERE
```{r my.analysis, echo=FALSE}
summary(cars)
```
Where it says LINK TO CHUNK NAMED MY.ANALYSIS HERE, am I able provide a link to the code chunk named my.analysis in the outputted PDF?
I believe the OP asked a similar, but slightly different question here: figure captions, references using knitr and markdown to html
Do this:
Report
========================================================
This is my report. Some analysis is included in \href{http://stackoverflow.com/q/16445247/1000343}{LINK TO CHUNK NAMED MY.ANALYSIS HERE}
```{r my.analysis, echo=FALSE}
summary(cars)
```
And then covert the markdown file (not Rmd) to the PDF.
This also works using the devel version of reports:
```{r setup, include=FALSE}
# set global chunk options
opts_chunk$set(cache=TRUE)
library(reports); library(knitr);
```
Report
========================================================
This is my report. Some analysis is included in `r HR("http://stackoverflow.com/q/16445247/1000343", "LINK TO CHUNK NAMED MY.ANALYSIS HERE")`
```{r my.analysis, echo=FALSE}
summary(cars)
```
You then convert the html file to pdf.
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