First commit
This commit is contained in:
commit
851a889411
|
@ -0,0 +1,12 @@
|
|||
*.pdf
|
||||
.Rproj.user
|
||||
.Rhistory
|
||||
_cache
|
||||
_site
|
||||
cache
|
||||
diamonds.csv
|
||||
temp.Rmd
|
||||
*.html
|
||||
*_cache
|
||||
*_files
|
||||
figures
|
|
@ -0,0 +1,29 @@
|
|||
language: c
|
||||
|
||||
before_install:
|
||||
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
|
||||
- chmod 755 ./travis-tool.sh
|
||||
- ./travis-tool.sh bootstrap
|
||||
|
||||
install:
|
||||
# Install binary pandoc from Rstudio
|
||||
- export PATH="$HOME/pandoc:$PATH"
|
||||
- mkdir $HOME/pandoc
|
||||
- curl -O https://s3.amazonaws.com/rstudio-buildtools/pandoc-1.12.3.zip
|
||||
- unzip -j pandoc-1.12.3.zip pandoc-1.12.3/linux/debian/x86_64/pandoc
|
||||
-d $HOME/pandoc
|
||||
- chmod +x $HOME/pandoc/pandoc
|
||||
- pandoc --version
|
||||
|
||||
# Install jekyll
|
||||
- travis_retry gem install jekyll mime-types
|
||||
|
||||
# Install R packages
|
||||
- ./travis-tool.sh r_binary_install knitr png
|
||||
- ./travis-tool.sh r_install ggplot2 dplyr tidyr
|
||||
- ./travis-tool.sh github_package hadley/bookdown
|
||||
|
||||
script: jekyll build
|
||||
|
||||
after_success:
|
||||
- cp -r figures/ _site/figures
|
|
@ -0,0 +1 @@
|
|||
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/us/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
|
|
@ -0,0 +1,12 @@
|
|||
# R packages
|
||||
|
||||
This is code and text behind the [R for data science](http://r4ds.had.co.nz)
|
||||
book.
|
||||
|
||||
The site is built using jekyll, with a custom plugin to render `.rmd` files with
|
||||
knitr and pandoc. To create the site, you need:
|
||||
|
||||
* jekyll gem: `gem install jekyll`
|
||||
* bookdown: `install_github("hadley/bookdown")`
|
||||
* [pandoc](http://johnmacfarlane.net/pandoc/)
|
||||
* [knitr](http://yihui.name/knitr/): `install.packages("knitr")`
|
|
@ -0,0 +1,5 @@
|
|||
name: R packages
|
||||
markdown: redcarpet
|
||||
highlighter: pygments
|
||||
|
||||
exclude: ["CONTRIBUTING.md", "README.md", "book"]
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/Rscript
|
||||
library(rmarkdown)
|
||||
library(bookdown)
|
||||
library(methods)
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
path <- args[1]
|
||||
|
||||
if (!file.exists(path)) {
|
||||
stop("Can't find path ", path, call. = FALSE)
|
||||
}
|
||||
|
||||
if (file.access(path, 4) != 0) {
|
||||
stop("Can't read path ", path, call. = FALSE)
|
||||
}
|
||||
|
||||
html_path <- render(path, html_chapter(raw = TRUE, toc = "toc.rds"),
|
||||
quiet = TRUE)
|
||||
|
||||
read_file <- function(path) {
|
||||
size <- file.info(path)$size
|
||||
readChar(path, size, useBytes = TRUE)
|
||||
}
|
||||
cat(read_file(html_path))
|
|
@ -0,0 +1,33 @@
|
|||
require 'tempfile'
|
||||
|
||||
module Jekyll
|
||||
class RMarkdownConverter < Converter
|
||||
safe :false
|
||||
priority :high
|
||||
|
||||
def matches(ext)
|
||||
ext =~ /^\.(rmd|rmarkdown)$/i
|
||||
end
|
||||
|
||||
def output_ext(ext)
|
||||
".html"
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
f = File.new("temp.Rmd", "w")
|
||||
f.write(content)
|
||||
f.write("\n")
|
||||
f.flush
|
||||
|
||||
# http://rubyquicktips.com/post/5862861056/execute-shell-commands
|
||||
content = `_plugins/knit.r temp.Rmd`
|
||||
|
||||
if $?.exitstatus != 0
|
||||
raise "Knitting failed"
|
||||
end
|
||||
|
||||
content
|
||||
# File.unlink f.path
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Contributing
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
This book has been developed in the open, and it wouldn't be nearly as good
|
||||
without your contributions. There are a number of ways you can help make the
|
||||
book even better:
|
||||
|
||||
* If you don't understand something, please
|
||||
[let me know](mailto:h.wickham@gmail.com). Your feedback on what is confusing
|
||||
or hard to understand is valuable.
|
||||
|
||||
* If you spot a typo, feel free to edit the underlying page and send a pull
|
||||
request. If you've never done this before, the process is very easy:
|
||||
|
||||
* Click the edit this page on the sidebar.
|
||||
|
||||
* Make the changes using github's in-page editor and save.
|
||||
|
||||
* Submit a pull request and include a brief description of your changes.
|
||||
"Fixing typos" is perfectly adequate.
|
||||
|
||||
* If you make significant changes, include the phrase "I assign the
|
||||
copyright of this contribution to Hadley Wickham" - I need this so I can
|
||||
publish the printed book.
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
layout: default
|
||||
title: Welcome
|
||||
output: bookdown::html_chapter
|
||||
---
|
||||
|
||||
# R for Data Science
|
||||
|
||||
This is the book site for __"R for data science"__. It will be published with O'Reilly in July 2016.
|
||||
|
||||
<img src="cover.png" width="250" height="328" alt="Cover image" />
|
||||
|
||||
|
||||
<ul class="toc">
|
||||
{% include package-nav.html %}
|
||||
</ul>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
Version: 1.0
|
||||
|
||||
RestoreWorkspace: Default
|
||||
SaveWorkspace: Default
|
||||
AlwaysSaveHistory: Default
|
||||
|
||||
EnableCodeIndexing: Yes
|
||||
UseSpacesForTab: Yes
|
||||
NumSpacesForTab: 2
|
||||
Encoding: UTF-8
|
||||
|
||||
RnwWeave: Sweave
|
||||
LaTeX: XeLaTeX
|
||||
|
||||
AutoAppendNewline: Yes
|
||||
StripTrailingWhitespace: Yes
|
Loading…
Reference in New Issue