Prompt:
The goal of this week’s blog is to document what you are doing when things do not go according to plan.
Similar to previous exercises, we have a specific use case in mind: we want to build a book from a github repository.
What happens in practice usually, is that we run into some problems. So your real task turns into that of a bug-hunter and fixer. Luckily, you have a community (the class discussion board) who might be able to help you.
What we want: build a book
Build the html version of the 2nd edition for Hadley Wickham’s book Advanced R Programming
from a github repository.
Steps:
- Clone the repository
https://github.com/hadley/adv-r
. - Open the R project in the repository in RStudio.
- Activate the
Build
tab (by default in the top right panel). Click on theBuild Book
button. - The book will be available in html format as index.html
Deliverable (1): what is the last word in chapter 15? - You don’t have to answer this question, if things don’t work.
Solution From Chapter 15,
Last Line is Define a length method for the Person class.
Last word is class
What to do when things don’t work?
I am able to build bookdown as a html version but unable to process as pdf.
Even for html version,
I had many issue but figured out mostly from internet as well from canvas discussion group. For multiple package issue, i searched on the Google an figured it out.
Moreover,One of the issue was
“Quitting from lines 106-107 (Control-flow.Rmd) Error in if (c(TRUE, FALSE)) 1 : the condition has length > 1 Calls: local … withVisible -> eval_with_user_handlers -> eval -> eval”
I found the solution like ‘Setting error=TRUE’ after going through the canvas discussion. The discussion page was quite helpful in building the bookdown as a html.
Secondly, I am unable to generate pdf after building the solution. i didn’t find the any solution which work for me on canvas and also from the internet.I posted the question on the canvas discussion page.
I am getting error like:
“Error: LaTeX failed to compile _main.tex. See. https://yihui.org/tinytex/r/#debugging for debugging tips. See _main.log. for more info. Execution halted. ”
Here are few steps i tried:
- i followed the link: https://yihui.org/tinytex/r/#debugging.
- installed tinytex.
- instlled pandoc.
- checked pdflatex, xlelatex is installed on the system.
- check few other packages but none of them works.
Deliverable (2): Write a paragraph on the biggest problem you encountered when you were building the book, (and how you managed to solve it.)
Solution There are multiple issues,i have faced while building the bookdown. Firstly, I have to install all the packages required for the bookdown. Moreover, during building as bookdown::bs4_book, i faced few challenges like setting error=True to control.rmd file and also set registerS3method(“wrap”, …) to registerS3method(“sew”, …) in common.R file. I found the solution from the canvas discussion , it was really helpful and able to build bookdown as html version.
Once html version was build, i tried building as pdf file but unable to get success. I tried multiple things which is listed above .the biggest challenge was converting tex file to pdf ,it seems some system issue to install Miktex but even after installing ,it didn’t work. I am unable to fix (bookdown as pdf) yet.