Ggplot2 - Elegant Graphics for Data Analysis


#1

I am trying to run the code located here (https://github.com/hadley/ggplot2-book/blob/master/README.md) to build a PDF of ggplot2 - Elegant Graphics for Data Analysis. Here is the code.

git clone https://github.com/hadley/ggplot2-book.git
cd ggplot2-book
make clean
make

When I run that in R, I get an error that says something like Error unexpected symbol in git clone. Has anyone else had that issue or does anyone know what I need to do to fix that? Any help would be greatly appreciated! Thank you!


#2

Those are instructions for the command line, not the R environment. You can likely do the entire process from RStudio by creating a new project and using the “Version Control” type, allowing you to clone the repository as part of the project creation.


#3

Yup, like @nick said, those instructions are meant for the terminal. You can either clone the repo from terminal/command line, using your personal fave git client, or through RStudio’s interface (which I just happen to have done a little visual of the other day).

If you’re new to Git, I recommend taking a look at Jenny Bryan’s Happy Git with R, which will get you up and running.


#4

This thread gave me the funny idea to try building the book myself :grinning:

However, I ran into issue

Rscript book/render-tex.R data-manip.rmd
Makefile:23: recipe for target ‘book/tex/data-manip.tex’ failed
Error in loadNamespace(name) : there is no package called ‘oldbookdown’
Calls: :: … tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted
make: *** [book/tex/data-manip.tex] Error 1

Exited with status 2.

Has anyone else experienced this problem? I am even unsure whether the package in question is meant to be R (there certainly is no oldbookdownon CRAN) or LaTeX.


#5

Hey,

So I ran into the same thing as well, and I installed the deprecated oldbookdown here:

However, I ended up with a pandoc error, which is definitely not something I’m good at fixing— this is an error I’ve encountered in other scenarios, and have been unable to fix, so I’m not sure that it’s actually related to trying to make the ggplot2 book.
¯\(°_o)/¯

Rscript book/render-tex.R data-manip.rmd
--chapters has been removed. Use --top-level-division=chapter instead.
Try pandoc --help for more information.
Error: pandoc document conversion failed with error 2
Execution halted
make: *** [book/tex/data-manip.tex] Error 1

#6

I tried again (with the oldbookdown package from Github installed, thanks for the link!) and ran into yet different sort of error - not Pandoc, but applying anonymous function and not finding object called group.

I suppose we have to accept as a fact of life that unmaintained R code gets stale rather quickly, given the fast pace of package development.

On brighter side: I will stop being smart and just go and buy the book. It will give me the satisfaction of owning a physical asset, and it will carry more weight of argument than a bunch of ones and zeroes…


#7

Hi everyone, thank you very much for your replies. I tried the code in the command line. I did not get any errors; however, it did not do what I expected. With that said, I am not very familiar with the command line, so maybe what I expected is not what it is supposed to do. The github site says, “You can build the pdf by cloning this repo and running make.” To me, that sounds as though running the code will create a pdf of the most recent version of the book by using the files on the github site. When I ran the code, all it did was simply recreate the file and folder structure from the github site locally on my computer. Does anyone have any ideas on how to actually build a pdf of the book? Thank you again.


#8

I am afraid that the book will not build easily using the current versions of R, RStudio and required packages.


#9

Yes, you would likely need to pull up old versions of Pandoc and several associated packages. It shows the importance of the threads on the forum about creating a truly reproducible environment!