R for Data Science (Pdf)

Published by onesixx on

http://brettklamer.com/diversions/statistical/compile-r-for-data-science-to-a-pdf/  을 번역함

Compile “R for Data Science” source on GibHub to a PDF

 

1. Download the repository

from https://github.com/hadley/r4ds
압축풀고, 작업디렉토리 변경

setwd("~/Downloads/r4ds-master/")

2. 필요 package설치 

R에서 devtools를 사용하여 github 설치

devtools::install_github("hadley/r4ds")
devtools::install_github("wch/webshot")
Downloading GitHub repo hadley/r4ds@master
from URL https://api.github.com/repos/hadley/r4ds/zipball/master
Installing r4ds
Installing condvis
Installing htmltools
Installing Rcpp
Installing htmlwidgets
Installing knitr
Installing evaluate
Installing markdown
Installing Lahman
Installing dplyr
Installing bindrcpp
Installing glue
Installing rlang
Installing leaflet
Installing png
Installing raster
Installing sp
Installing viridis
Installing viridisLite
Installing maps
Installing microbenchmark
Installing pryr
Installing rmarkdown

* certification 에러시, 아래 먼저 설정후 다시 진행

> library(httr)
> set_config(config(ssl_verifypeer = 0L))

phantomjs 설치 

|⇒ sudo apt install phantomjs

아래 TeX 매니저를 위해 추가 perl-tk설치

|⇒ sudo apt install perl-tk

TeX manager 인 TeX Live에서,

|⇒ sudo env PATH="$PATH" tlmgr --gui
(running on Debian, switching to user mode!)
Loading local TeX Live database
  (/Users/onesixx/texmf/tlpkg/texlive.tlpdb)
This may take some time, please be patient ...
cannot setup TLPDB in /Users/onesixx/texmf at /usr/bin/tlmgr line 5604.
Compilation failed in require at /usr/bin/tlmgr line 4621.

 3. 책을 Compile 한다. 

bookdown::render_book("index.Rmd", output_format = "bookdown::pdf_book")
Output created: _book/_main.pdf
[1] "/Users/onesixx/Downloads/r4ds-master/_book/_main.pdf"

cf.  Static website

bookdown::render_book("index.Rmd", output_format = "bookdown::gitbook")

 

 

Categories: R Tidyverse

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x