Giter VIP home page Giter VIP logo

knitr-book's Introduction

Dynamic Documents with R and knitr

In the very beginning, I planned to write this book with Markdown, but later I changed my mind and wrote it in LyX instead. For those who are still interested in the Markdown source, please see the markdown directory.

Now this book has been published by Chapman & Hall. You can also find it on Amazon. There is a book review published in the Journal of Statistical Software, which may give you a better idea of this book than my own introduction.

The book source

Besides the old Markdown source which is really only an empty sketch, this repository also provides the real source files for the first three chapters of the book, so that you can learn how the book was written and quickly get started with writing books using the LaTeX style by Chapman & Hall.

The main file is DDR-Yihui-Xie-Chap1-3.lyx; the Rnw file DDR-Yihui-Xie-Chap1-3.Rnw was exported from LyX; krantz.cls is the LaTeX class provided by Chapman & Hall, and I wrote a simple LyX layout file krantz.layout; DDR-Yihui-Xie.bib contains some bibliography entries, and DDR-packages.bib is dynamically generated from knitr (see the last chunk in the LyX or Rnw file).

The PDF of the first three chapters can be downloaded here ⬇️.

For Linux users, the minimal version of LyX for this book is 2.0.3 (as you can get from Debian). For Windows/Mac OS X users, just download the latest binaries from the LyX website. If you do not use LyX, you can simply open the Rnw file and start from there.

Be sure to read the session info in the preface because your R packages may not be up-to-date to reproduce the PDF. Normally I use development versions of my packages, because I often find little problems that I need to solve for the book, and these changes will end up in the development versions.

Contact

GitHub issues (https://github.com/yihui/knitr-book/issues) is the preferred way for feedbacks. You can also reach me by email if you really want:

echo oybuwycxy.trpb | tr bopcrbtucwxyc+ exmiaen@iyuih

knitr-book's People

Contributors

karthik avatar laurentgatto avatar ramnathv avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knitr-book's Issues

Listing added hook drops it by default (gotcha).

Create the "margin" hook:

knit_hooks$set(margin = function(before, options, envir) {
    if (before) {
      par(mar = c(4, 4, 0.1, 0.1))
    }
    else NULL
})

...

Later, we want to list the hook:

Watch out, the default is to drop the hook (drop=TRUE).
So this code lists the hook and removes it!

knit_hooks$get('margin')

This is the workaround

knit_hooks$get('margin', drop=FALSE)

guide to font installation (Tex Gyre Pangella)?

Any hint on getting the fonts configured (on say, Ubuntu?) When compiling pdf, I get the error:

kpathsea: Invalid fontname `TeX Gyre Pagella', contains ' '

Config notes: I'm on Ubuntu 11.10, I have the file
/usr/share/texmf/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf

and
fc-list | grep Pagella
returns
TeXGyrePagella:style=BoldItalic
TeXGyrePagella:style=Regular
TeXGyrePagella:style=Bold
TeXGyrePagella:style=Italic

Not sure what I've missed. thanks!

transparency in plots with tikz device?

The shading in intro_plot.pdf created by tikz (output from ./knit pdf) is opaque, covering the data. With png or pdf devices transparency works properly. Is this just me? How do I get transparent highlighting with the tikz device?

terminology (tangle)

someone says tangle is Sweave terminology and beginners will not understand knit(..., tangle=TRUE); true, I'll need to explain it in common language.

supress comments from xtable printing in latex

./knit pdf is working fine for me. The resulting latex table looks great, but xtable's comment is displayed in the pdf. For some reason, pandoc has decided that it should escape the % sign, rather than treat it as a comment. Does this happen when you compile the pdf also?

.lyx file does not open in my versions of Lyx

Hi Yihui,

I just tried to open the main .lyx file in old (1.6) and newer (2.0.2) versions of LyX. In both versions I get this error message: *Chap1-3.lyx is not a readable LyX doxument.

bookprob

I suspect other people may have this problem which reduces the reproducibility of the work. Please tell us the solution!

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.