Link to daffodil in R markdown

I use knitr to insert R code into a markdown file (. Rmd). I am converting a file to a PDF file using Pandoc. The contents of my .Rmd file are as follows:

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 he says LINK TO CHUNK NAMED MY.ANALYSIS HERE, can I provide a link to a piece of code named my.analysis in the downloaded PDF file?

I believe that the OP asked a similar but slightly different question: captions to pictures, links using knitr and markdowns on html

+4
source share
1 answer

Do it:

 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 a hidden markdown file (not Rmd) in the PDF.

This also works with the 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) ``` 

Then you convert the html file to pdf.

+1
source

Source: https://habr.com/ru/post/1479776/


All Articles