Giter Site home page Giter Site logo

boylad / rmarkdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstudio/rmarkdown

0.0 1.0 0.0 88.98 MB

Dynamic Documents for R

Home Page: https://rmarkdown.rstudio.com/

R 53.92% CSS 10.97% HTML 2.64% TeX 3.94% JavaScript 26.23% Lua 1.86% Shell 0.45%

rmarkdown's Introduction

Overview

Build Status

The rmarkdown package is a next generation implementation of R Markdown based on pandoc. This implementation brings many enhancements to R Markdown, including:

  • Create HTML, PDF, and MS Word documents as well as Beamer, ioslides, and Slidy presentations.
  • New markdown syntax including expanded support for tables, definition lists, and bibliographies.
  • Hooks for customizing HTML and PDF output (include CSS, headers, and footers).
  • Include raw LaTeX within markdown for advanced customization of PDF output.
  • Compile HTML, PDF, or MS Word notebooks from R scripts.
  • Extensibility: easily define new formats for custom publishing requirements.
  • Create interactive R Markdown documents using Shiny.

Note that PDF output (including Beamer slides) requires an installation of TeX.

See the R Markdown documentation for full details.

Installation

If you are working within RStudio then you can simply install the current release of RStudio (both the rmarkdown package and pandoc are included).

If you want to use the rmarkdown package outside of RStudio then you can install the package from CRAN as follows:

install.packages("rmarkdown")

A recent version of pandoc (>= 1.12.3) is also required. See the pandoc installation instructions for details on installing pandoc for your platform.

Usage

The render function is used to convert R Markdown (Rmd) files into various output formats (the default is HTML). Calling render will knit the specified input document and then produce the final output document using pandoc:

render("input.Rmd")

You can also specify a plain markdown file in which case knitting will be bypassed:

render("input.md")

Output Formats

R Markdown documents can contain a metadata section that includes both title, author, and date information as well as options for customizing output. For example, this metadata included at the top of an Rmd file adds a table of contents and chooses a different HTML theme:

---
title: "Sample Document"
output:
  html_document:
    toc: true
    theme: united
---

R Markdown has built in support for several output formats (HTML, PDF, and MS Word documents as well as Beamer presentations). These formats can also be specified in metadata, for example:

---
title: "Sample Document"
output:
  pdf_document:
    toc: true
    highlight: zenburn
---

If you aren't specifying format options you can also just use a simple format name:

---
title: "Sample Document"
output: pdf_document
---

Multiple formats can be specified in metadata:

---
title: "Sample Document"
output:
  html_document:
    toc: true
    theme: united
  pdf_document:
    toc: true
    highlight: zenburn
---

To select from the various formats defined you can pass a format name to render. For example:

render("input.Rmd", "pdf_document")

If no explicit format name is passed to render then the first one defined will be used. You can also render all formats defined in the file with:

render("input.Rmd", "all")

Shared Output Formats

You can also define output formats externally in a file named _output.yml located in the same directory as the R Markdown source file. For example:

html_document:
  toc: true
  theme: united
pdf_document:
  toc: true
  highlight: zenburn

Using an _output.yml file is a good way to share output settings across multiple R Markdown files in the same directory.

Output Format Functions

Output formats need not be specified in metadata. In fact, metadata is just a convenient way to invoke functions that implement output formats. There are seven built-in output formats each exported as a function from the package:

  • html_document
  • pdf_document
  • word_document
  • md_document
  • beamer_presentation
  • ioslides_presentation
  • slidy_presentation

As you'd expect, these functions can also be invoked as part of the call to render, for example:

render("input.Rmd", html_document(toc = TRUE))
render("input.Rmd", pdf_document(latex_engine = "lualatex"))
render("input.Rmd", beamer_presentation(incremental = TRUE))

For more details on the options available for each format see their respective help topics.

License

The rmarkdown package is licensed under the GPLv3 (http://www.gnu.org/licenses/gpl.html).

rmarkdown's People

Contributors

aoles avatar aronatkins avatar bearloga avatar bquast avatar byzheng avatar cboettig avatar christophergandrud avatar crsh avatar hadley avatar haozhu233 avatar hughjonesd avatar jameslamb avatar javierluraschi avatar jcheng5 avatar jdblischak avatar jjallaire avatar jmcphers avatar jmlondon avatar kevinushey avatar kiwiroy avatar mungojam avatar rich-iannone avatar robjhyndman avatar sigriston avatar steveharoz avatar trestletech avatar wch avatar yihui avatar yutannihilation avatar zeehio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.