Linking between RMarkdown files in a package

35 views Asked by At

I am looking to incorporate some html tutorial files (generated by RMarkdown) as part of a package that I am developing. My goal is to write a function that launches the tutorials and allows the user to navigate between the pages, but I am having trouble building the links between pages appropriately.

Here's the structure of the package:

+- DESCRIPTION
+- NAMESPACE
+- inst/
|  \- tutorials/
|     \- INDEX.html
|     \- T1.html
|     \- T2.html
\- R/
   +- code.R

I have written a function that successfully launches the INDEX.html tutorial:

tutorials <- function(){
  browseURL(system.file('tutorials/index.html', package = 'PACKAGE_NAME'))
}

What I want is for the Index.html file to have links to T1, T2, etc., however I can't figure out how to build this link. I assume I need to use system.file, but have not been able to figure out how to write the RMarkdown appropriately.

In other words, I am trying to do this:

---
title: "Tutorials"
output: 
  html_document:
    toc: true
---

# Tutorials

## [T1](T1.html)
## [T2](WHAT DO I PUT HERE)
0

There are 0 answers