GithubHelp home page GithubHelp logo

rtemplate's Introduction

RTemplate

RTemplate - R Markdown Template for Analysis

Update pandoc

0401

Download zip file from internet

recipes_data_dir <- tempdir()
s2_zip <- tempfile(fileext = ".zip")

download.file(url = "https://media.nature.com/original/nature-assets/srep/2011/111215/srep00196/extref/srep00196-s2.zip", destfile = s2_zip)

unzip(s2_zip, exdir = recipes_data_dir)

0701

Include graphics

  • output: pdf_document
{r rmarkdown, out.width="0.5\\textwidth"}
knitr::include_graphics("images/rmarkdown-sticker.png")
  • output: html_document
{r rmarkdown-sticker, out.width="50%"}
knitr::include_graphics("images/rmarkdown-sticker.png")

0702

Insert images using HTML

Here's the logo for Rmarkdown

<img src='images/rmarkdown-sticker.png' style='width:50%;min-width:300px'></img>

0704

  • Use rvest
{r get-google-doodle-url}
library("tidyverse")
library("rvest")
library("glue")

google_doodles_page <- read_html("https://www.google.com/doodles")
doodle_url <- google_doodles_page %>%
  html_node(".latest-doodle") %>%
  html_node("img") %>%
  html_attr("src") %>%
  str_replace("//", "")
doodle_url

download.file(url = doodle_url,
              destfile = "images/google-doodle.png")

0801 Table

  • Raw markdown
  • knitr::kable()
  • DT::datatable() -> interactive

0804

0805 DT

library("tidyverse")
library("fivethirtyeight")
library("DT")

bechdel %>%
  filter(year > 1990) %>%
  select(title, year, clean_test, binary, intgross_2013) %>%
  arrange(desc(intgross_2013)) %>%
  slice(1:20) %>% 
  datatable(filter="top")

Output options

output:
  pdf_document: 
    toc: true
    df_print: kable
  html_document: 
    toc: true
    df_print: kable
output: 
  html_document:
    df_print: paged

09 Captions with book down

0902

10 Custmize style

css file

  • 10.2, 10.3

11 Insert HTML and Latex

12 htmlwidgets

rtemplate's People

Contributors

haoqiwang97 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.