Vignettes are documents used to share some documentations about packages. R Notebooks are similar as scripts. In addition they offer the tools to add more textual information and execute some R code.
What is R Markdown
Markdown is a markup languages; it allows to format text using a set of well established symbol. Unlike HTML and other languages, Markdown relies on sequences of characters. Markdown relies on some plain-text syntax to format part of your text. R Markdown is a version of this markup language to allow within R Studio the creation of documents, such web pages, books and scientific articles.
Example of R Markdown
This is a basic example of R Markdown. It shows a title and the output as an html notebook. Some titles, paragraphs and R snippet code have been included within the plain-text document.
The output of the html notebook is shown below. It appears the # characters formats the Heading 1.
Additional reading list |
---|
Packages
You will need to install several packages and create the file structure required to write a vignette.
# install the package R Markdown and knitr install.packages("rmarkdown") install.packages("knitr") #create the folder structure usethis::use_vignette("my-vignette")
Additional reading list |
---|
Using R Notebooks
R notebooks can create some report in various format. Some textual content can be added alongside some R code. You can create a R Notebook using the icon shown below. Sections of the reports are formatted using the R markdown markup language.
Let’s practice
Use the code you have written in the R script you have created in the previous page (i.e., Becoming familiar with R studio). Produce a R Notebook with the same code.
Additional reading list |
---|