Giter VIP home page Giter VIP logo

rmarkdown-book's Introduction

The R Markdown Book

The comprehensive documentation of R Markdown, published by Chapman & Hall/CRC.

rmarkdown-book's People

Contributors

aj2duncan avatar asimumba avatar bcrossman avatar cderv avatar colinfay avatar cyrusyip avatar dcossyleon avatar desautm avatar federicomarini avatar gavinmasterson avatar geanders avatar gvwilson avatar hongtaoh avatar indrajeetpatil avatar isteves avatar jankislinger avatar jemus42 avatar mirca avatar nathaneastwood avatar petzi53 avatar raymondbalise avatar riccardoporreca avatar robitalec avatar salim-b avatar simone-romiti avatar sixvable avatar tszberkowitz avatar yihui avatar zkamvar 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rmarkdown-book's Issues

Document your own solution using linguist-detectable to show R Markdown in Linguist GitHub repo language statistics

I don't know if this is better here or in your Cookbook.

I think it would be worth adding a short section documenting your own solution here to making RMarkdown appear in the Linguist Languages statistics of a GitHub repository by add the following line to the .gitattributes file

*.Rmd linguist-detectable

or even safer catch the fully lower case .rmd file extension as well

*.[Rr]md linguist-detectable

It would be worth explaining that by default Linguist ignores R Markdown (RMarkdown in Linguist) from the Languages statistics because it's defined as type: prose here and files of that type are excluded from the statistics without the linguist-detectable override as detailed here.

I assign the copyright of this contribution to the authors of the book "R Markdown: The Definitive Guide".

Output inline R Markdown files

I recently bought the printed version of the book to support you, and its great!

I just read Section 2.2 Compile an R Markdown document. And I just got a little confused when reading:

"...With notebooks, you can run code chunks individually and see results right inside the RStudio editor. This is a convenient way to interact or experiment with code in an Rmd document, because you do not have to compile the whole document. Without using the notebooks, you can still partially execute code chunks, but the execution only occurs in the R console, and the notebook interface presents results of code chunks right beneath the chunks in the editor, which can be a great advantage..."

I turned to the online version of the book and discovered the same. As far as I can see in my Rmd files, I can indeed run code chunks and get the results right beneath the chunks in the editor, I'm sure this feature is something that has been added since that section was written.

So my suggestion is to update that section a little bit 😃.

Add documentation for sxss knitr engine

At least small examples and links to where to look for more

---
output:
  html_document: default
---
```{scss}
$main-color: salmon;
.bright {
  background-color: $main-color;
}
```
This is a [*bright*]{.bright} word.
---
output:
  html_document: default
---
```{sass}
$main-color: salmon
.bright 
  background-color: $main-color;
```
This is a [*bright*]{.bright} word.

4.1.5 Customizing logos added to each slide | R Markdown ioslides

Hi,
I'd like to adjust use the css customizations suggested in the section 4.1.5 on 'Adding a logo' to increase the logo size in all my slides, but I'm not sure which file I should edit. I only see the defaults.css file (under ...files>ioslides...>theme>css) that's created after I knit my current .Rmd presentation. Where can I add these customizations so that the bottom left logos in each slide appear a bit larger? And how can I make sure that this works robustly? Thanks!

No chapter on shiny_prerendered runtime. Should there be one ?

Looking for detailed information on runtime:shiny_prerendered I just saw that the book does not explain this format of the rmarkdown 📦 . It is only mentioned in the Interactive Tutorial part, as something to use with learnr::tutorial.

I think this is a missing part of the rmarkdown 📦 in the reference Rmarkdown book. Something that should be added in another edition or in another book i.e advanced Rmarkdown.

Failed local build

This maybe a bother, I don't know? But I'm trying to follow the development of the book locally on my computer. Though I keep getting this error despite installing the missing packages:

Quitting from lines 635-893 (rmarkdown.Rmd)
Error: 'file_string' is not an exported object from 'namespace:xfun'
Execution halted
Error: Failed to compile the book to bookdown::pdf_book
In addition: Warning message:
running command '"C:/PROGRA1/R/R-341.4/bin/x64/Rscript" -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book', quiet = FALSE)"' had status 1
Execution halted
Error in render_book_script(output_format, envir, quiet) :
Error 1 attempting to render book
Calls: -> -> in_dir -> render_book_script
In addition: Warning message:
running command '"C:/PROGRA1/R/R-341.4/bin/x64/Rscript" _render.R "bookdown::pdf_book"' had status 1
Execution halted

Exited with status 1.

Improve examples for parametrized report

This is not an issue, but a recommendation.

I would like to suggest that in the docs available in the Rmarkdown book you include two examples in chapter 15 (parameterized reports):

  • passing parameters as raw markdown text for the parameterized reports.
  • setting the title using a parameter

This information is available in other parts of the book, but I think including them there would make easier for other people starting to create report templates.

For example, something as such in the .Rmd file:

---
output: html_document
params:
  author: author
  date: !r lubridate::today()
  set_title: title
  obs: my_text_chunk_with_markdown
title: "`r params$set_title`"  
---

This is my parameter with markdown in a chunk:

 ```{r, results='asis', echo=FALSE}
 cat(params$obs)
 ```

This is my parameter with markdown with code inline: `r paste(params$obs)`.

and something as such for the script that renders it:

rmarkdown::render(
  path_to_file,
  params = list(
                 set_title =  'title',
                 author =  'author',
                 obs = 'This is a text with *markdown* syntax.',
       ),
  output_file = 'my_report.html')
)

suggestion for "2.7.2 shell scripts"

Nice book! Thanks for writing and publishing it. I'll grab a paper copy but likely refer to the electronic version more for easier searching.

In section "2.7.2 Shell Scripts", you suggest that Windows users can get the required functionality by installing Cygwin or WSL. I suggest that both require a bit more technical investment than is available and/or strictly necessary (not to mention large installations).

For the faint-of-heart (or space-limited), you can get most (admittedly) functionality out of Git for Windows, as it contains bash, awk/sed/tr, bzip2/bunzip2/unzip (but not zip!), git/diff/patch, grep/sort/uniq/wc, find/file/xargs, and many others. Two other alternatives (I have not tested them) are Gnu on Windows ("the lightweight alternative to Cygwin") and, in a pinch, even Rtools includes sh and a few of the above commands.

It's perhaps easier to push for GfW since RStudio already incorporates a bunch of git integration, so this would be a logical step (and a fluid endorsement of it in the book).

Switch from master to main

@yihui just a heads up that I renamed the branch from master to main here.

You need to reconfigure your local repo either using usethis::git_default_branch_rediscover() or git command

git branch -m master main
git fetch upstream
git branch -u origin/main main
git remote set-head origin -a

Does the author have right to publish the book again after accepting pull requests?

This a nice book! I noticed that it is an opensource book licensed under
Attribution-NonCommercial-ShareAlike 4.0 International. It means others can send pull requests to improve it, and the author( @yihui ) can earn money from it. I think it is a good practice of earning money from writing opensource books. I also want to write such a book.

It is no doubt that the author can commercially sell books under Attribution-NonCommercial-ShareAlike 4.0 if he or she writes the wholebook.

Say that I wrote an opensource book under Attribution-NonCommercial-ShareAlike 4.0 . I wonder whether I can sell my book after accepting others' pull requests? Can I use the pull request content commercially?

Is there any plan for translation and publishing?

I assign the copyright of this contribution to the authors of the book "R Markdown: The Definitive Guide".

Just wondering, because some people would like to read the document in their native languages.

Description of `include_graphics`

From what I can see, images are discussed briefly in Section 2.4.1 using the syntax [alt text or image title](path/to/image) . However, I feel the include_graphics() method is more stable, as is already explained in bookdown book.

I can't see any reference to this anywhere in the book, but wanted to ask where best to insert it before making a pull request? I would suggest that is shown quite early on, probably in the Basics chapter, but I cannot see a natural place for it to fit in currently.

Error building the book.

Hi,大家好,
最近在学习R markdown,了解到这本正在写作中的书,下载了项目尝试build一下,有几个小问题反馈一下。
1、 01-intro.Rmd
1)、images/01-notebook-preview.jpg应改为images/01-notebook-preview.png,并重命名文件, png格式。

knitr::include_graphics("images/01-notebook-preview.png")

2、images/01-dynamic-document.jpg应改为images/01-dynamic-document.png,并重命名文件, png格式。

knitr::include_graphics("images/01-dynamic-document.png")

2、build HTML与word都可以,但build PDF出错,不知到写作团队测试过build PDF没有。我是菜鸟,还无法定位解决问题。不过知道PDF中laTeX数学公式等的效果比Word要方便很多和好很多。
···

sucess

bookdown::render_book('index.Rmd',"bookdown::word_document2")

Failed

bookdown::render_book('index.Rmd',"bookdown::pdf_book")
···
Error message:

Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number
In addition: Warning messages:
1: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
2: In system2("python", c("-c", shQuote(code)), stdout = TRUE) :
  running command '"python" -c "print(1 + 1)"' had status 9009
3: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
4: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
5: In png::readPNG(path, native = TRUE, info = TRUE) :
  Image uses 16-bit channels but R native format only supports 8-bit, truncating LSB.
6: In knitr::write_bib(c(.packages(), "bookdown", "knitr", "rmarkdown",  :
  package(s) flextable, gt, gtsummary, formattable, reactable, rhandsontable, pixiedust, stargazer, tables, tangram, ztable, condformat, printr, styler, ezknitr, rmdformats, learnr, blogdown, spelling, blastula, workflowr, xaringanthemer, diagram, rmdrive, xaringanExtra, fusen not found
7: In utils::citation(..., lib.loc = lib.loc) :
  no date field in DESCRIPTION file of package 'datadrivencv'
8: In utils::citation(..., lib.loc = lib.loc) :
  could not determine year for 'datadrivencv' from package DESCRIPTION file
9: In utils::citation(..., lib.loc = lib.loc) :
 
 Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number 

4.2.2 Adjusting font-size in ioslides using R Markdown

Thanks for the detailed super-helpful book, @yihui
Quick question. I read the sections on adjusting font-size in slides (R Markdown, ioslides presentation). Seems like I can use {.smaller} to change it for the whole slide.
I also read that footers can be added (if included in the file definition 4.2.3).

Qn: Is there a way to adjust the font size of individual lines in a particular slide? I tried appending the line with {.smaller} and {.bigger} but that doesn't work within the slide.
Thanks!

Typo collection

You may also suggest new topics to us. Thanks!

In chapter 3.2,

There is also a Restart R and Run All Chunks item in the Run menu on the editor toolbar, which gives you a fresh R session prior to running all the chunks.

It's now in the Session menu, not the Run menu😂

valueBox icons not big

Trying your example file 04-valueboxes.Rmd my awesome icons are very small and at the left bottom corner of the box. Not sure if I missed something (some css styling?) or there is something wrong.

[The recommended change in css styles (e.g. W3schools or StackOverflow did not work for me (or I did not know where and how to apply them in the example code.]


I am using rmarkdown version 1.10, pandoc version 1.19.2.1 and RStudio Version 1.1.453 on a macOS 10.13.5.

Custom macros? Not a widget, but a macro

If I wanted to create a new macro, similar to the $ or $$ macro for mathematics, how would I do that?

In that same line, if I wanted to create a parser that would take LATEX code in its native format and "translate" it so it could render as HTML without forcing the LATEX code to match the very limited Rmd syntax.

How do I underline in Rmd exactly? How do I embed nested HTML? It is very limited, so there needs to be some macro options such as "ignore". Include as HTML but ignore in terms of processing.

For example,

That is nested HTML and breaks.

How can I include HTML blocks inline from an external source. Not in YAML as header/footer, but inline "similar to latex input syntax".

It seems like you are trying to build a templating language without all the necessary ingredients. If I want to hack on it, how do I do that?

Compilation failure building pdf

  1. Clone repo.
  2. make pdf.
  3. Install a bunch of packages (list below).
  4. Finally get this far with make pdf on the command line, but still no PDF.
~/rmarkdown-book + master$ make pdf
Rscript --quiet _render.R "bookdown::pdf_book" &&\
	mv _book/rmarkdown.pdf _book/rmarkdown-full.pdf
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

  always_allow_html: yes

Note however that the HTML output will not be visible in non-HTML formats.

Execution halted
Error: Failed to compile the book to bookdown::pdf_book
Execution halted
make: *** [pdf] Error 1

Packages installed (in order, as error messages come up):

  • revealjs
  • bookdown
  • blogdown
  • rticles
  • flexdashboard
  • learnr
  • pkgdown
  • xaringan
  • tufte

Problem publishing

Hello, I am trying to publish a report in Posit Connect. I've connected properly. I can render correctly. When publishing, execution halts, and this is the message:
{"code":109,"error":"This type of content is not allowed because it is prohibited by policy.","payload":null}
Error in POST():
! https://bookdown.org/__api__/applications/14123/deploy failed with
HTTP status 403
This type of content is not allowed because it is prohibited by policy.

I've looked at stack overflow, set to basic yaml configuration and always comes the same message. Any clue on how i can solve this?
Thanks in advance for reading me.

Page number in powerpoint

Hello,
Manu thanks for your very interesting book.
I have a question concerning chapter "4.4 PowerPoint presentation" :
How can I get the page number be displayed on the generated slides ?
In advance many thanks
Best regards

New slide in Xaringan

Section 7.3.1 begins with

Every new slide is created under a horizontal rule (---).

In order to get a new slide, the dashes have to be followed by a new line. It took me a bit of googling to discover this. The text should be modified to describe actual behavior. For example add:

Note that the dashes have to be followed by a new line.

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.