bookdown | Authoring Books and Technical Documents with R Markdown
kandi X-RAY | bookdown Summary
kandi X-RAY | bookdown Summary
A open-source (GPL-3) R package to facilitate writing books and long-form articles/reports with R Markdown. Features include:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bookdown
bookdown Key Features
bookdown Examples and Code Snippets
Community Discussions
Trending Discussions on bookdown
QUESTION
As explained in this chapter of the R Markdown Cookbook, it is possible to make custom blocks in R Markdown files with this syntax (here, to center some text):
...ANSWER
Answered 2021-Jun-06 at 09:06There are two issues:
- You use
print()
instead ofcat()
(even if you refer to cat() in your post - You put spaces at the beginning of each line which prevents the custom block to be rendered.
- If you prefer the lines to be indented (as I do) then I would suggest make each line a separate string as I do in the second example. This also has the advantage that you could add the line breaks via the
sep
argument instead of having to add them manually.
Reproducible example:
QUESTION
We frequently use RMarkdown based packages to create websites with R (bookdown
, blogdown
, distill
...) and use github-pages to serve the html files via the url username.github.io/repo
.
In this approach, the ouput (i.e. html / css) files are also version controlled, and are frequently included in commits by mistake (git commit -a
). This is annoying since these files clutter the commit and often lead to fictitious files conflicts.
Ideally, the outputfiles would not be version controlled at all, since the binary files (images) additionally bloat the repo. So I'm looking for a solution where:
- Git ignores the output files completely but provides an alternative (but comparable1) method to gh-pages to serve them
- Git ignores the output files temporally and committing / pushing them to gh-pages is done in a separate, explicit command
1: The method should be command line based and provide a nice URL to access the website
...ANSWER
Answered 2021-May-25 at 14:11You could have .html
, .css
etc. ignored in the main
and all other branches but the branch, for example, the gh-page
branch, where your github-page is built from.
Git does not support different .ignore
files in different branches so you would have to set up a bash script that replaces the ignore file each time you checkout a new branch. See here for how to do that: https://gist.github.com/wizioo/c89847c7894ede628071
Maybe not the elegant solution you were hoping for but it should work.
QUESTION
I am working on converting a tufte-LaTeX book to tufte-Bookdown using the tufte and msmbstyle packages. I have a whole bunch of sidenotes and would like the numbering to restart with each chapter so I don't reach like 400 by the end of the book.
I found this CSS code in the Bookdown GitHub for doing this with regular Bookdown, which uses footnotes/endnotes. However, my attempts to modify the code to work with sidenotes have failed. This is my current CSS addition, which just takes that code and drops in sidenote
or sidenote-number
(which Inspect Element suggests are the correct tags) where footnote
originally was:
ANSWER
Answered 2021-May-26 at 05:27I ended up paying someone to solve this. They wrote some JavaScript that will fix it. The following code can be saved as an HTML file, and added to the book with
QUESTION
I am trying to use a parameterized path for a reference_docx
in a Rmarkdown document with rmarkdown::word_document
output format, in a similar way as e.g. is done here for the bibliography file (section Bibliograghy and Citation YAML options).
However, it seems like this feature does not work for the reference_docx
option, as expressions passed to the arguments of the output format function (rmarkdown::word_document
, or bookdown::word_document2
for that matter) are interpreted literally instead of evaluated. See e.g. this minimal reprex:
- Working example:
ANSWER
Answered 2021-May-24 at 15:02Apparently, the problem is with trying to access params
from within the yaml
header itself. As stated here,
Finally,
params
(the list of parameters provided within the knitting environment) is not available for yaml expressions.
Other than that, the field reference_docx
can evaluate expressions the same way as other yaml
header fields, see e.g..
Consequently, my own (working) example, adapted to this, would be:
QUESTION
Uses:
...ANSWER
Answered 2021-May-23 at 12:38The solution is: paste0().
Full code, updated and fully functioning:
QUESTION
I am looking to create unique/individual reports for a given list of vendors. The ideal output format would be a seperate html file of the given vendors information.
The issue is that I am having trouble wrapping my head around creating parameterized reports in RMarkdown. I have been taking a look at this link to understand how to loop/iterate through RMarkdown reports
To illustrate and share the logic of what I want to execute is the following:
...ANSWER
Answered 2021-May-13 at 20:42I think the step you were missing was specifying the output filename so that each "vendor" would have its own file; otherwise, the same filename is overwritten each time leaving you with a single HTML document.
An example:
QUESTION
According to the rmarkdown cookbook, using knitr::include_url
should produce an inline frame of the webpage (note that it works and contains images):
But when I do the exact same thing in HTML document, I see no images in my inline frame, and I am not sure why:
DetailsIn case it helps, here are some more details:
YAML for my document
...ANSWER
Answered 2021-May-11 at 01:54This is due to a change in a recent version of Pandoc (not that recent but a few months ago) that it will embed URLs as base64 data. I just patched knitr to change this behavior. You can try the dev version of knitr:
QUESTION
I am gradually building an R Markdown (.RMD) file, learning by doing. I was able to insert a couple of tables, but I had a problem with one of them. The initial setup is:
...ANSWER
Answered 2021-May-10 at 20:48According to wiki, there are some characters that needs escaping
Here, is a tested version of the markdown code
QUESTION
I want to include my supervisor's name, course name etc. for my paper written in bookdown. I specifically want this information to be in different lines. So far I have tried this in the yaml:
...ANSWER
Answered 2021-May-05 at 09:02Using a "line block" should do the trick:
QUESTION
When I knit any of the CV templates in the R package vitae I get a slightly different error for each one. I've made sure that all the files, including my Rmd file, are in the same directory and I haven't changed the template in any way. When I knit the modern CV template, for example, I get this error message:
...ANSWER
Answered 2021-May-04 at 02:32A combination of reinstalling R Studio after uninstalling MikTex, and finally installing the R package tinytex worked.
I think @samcarter_is_at_topanswers.xyz was right that "the problem was an outdated latex version. utf8 became the default encoding some time ago, but if your tex version was older then such special characters would cause problems. "
Lessons learned:
The tinytex package is all you need for R Markdown. You can even open tex files in R Studio to edit and compile them to pdf. See how to install it here.
Update MikTex frequently. I assumed that it automatically updated when needed, but that seems not to be true. Windows > MikTex > Update. It's that simple. Remembering to do it is another thing if you decide to use it.
Being able to check that the environment paths are all there and are pointing to the right directory didn't help in this case, but it was good to learn. This link was helpful.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bookdown
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page