knitr

Programmatically create tab and plot in markdown

微笑、不失礼 提交于 2020-12-23 11:07:49
问题 I'm trying to create a dynamic number of tabs in my rmd with some content inside. This one doesn't help. Something like this: --- title: "1" output: html_document --- ```{r } library(highcharter) library(tidyverse) iris %>% dplyr::group_split(Species) %>% purrr::map(.,~{ # create tabset for each group ..1 %>% hchart("scatter", hcaes(x = Sepal.Length, y = Sepal.Width)) }) ``` 回答1: You can set results = 'asis' knitr option to generate the tabs in the map function using cat . Getting Highcharter

Programmatically create tab and plot in markdown

别来无恙 提交于 2020-12-23 11:05:13
问题 I'm trying to create a dynamic number of tabs in my rmd with some content inside. This one doesn't help. Something like this: --- title: "1" output: html_document --- ```{r } library(highcharter) library(tidyverse) iris %>% dplyr::group_split(Species) %>% purrr::map(.,~{ # create tabset for each group ..1 %>% hchart("scatter", hcaes(x = Sepal.Length, y = Sepal.Width)) }) ``` 回答1: You can set results = 'asis' knitr option to generate the tabs in the map function using cat . Getting Highcharter

New Pandoc distrib = loose cross-references (RMarkdown - knitr - Bookdown - thesisdown - R)

不羁的心 提交于 2020-12-12 21:36:15
问题 I've loose some cross-references when exporting a bunch of .Rmd files to a single .doc file, using knitr and bookdown (+ yaml). The method is thesisdown::thesis_word:. The problem of loosing-references occurred immediately after I've installed a new version of Pandoc. Maybe I miss a step after Pandoc installation ? The lost references are currently the \@ref(title) ones, which previously return the number of the title indicated by : # My title {#title} and now return (??) . Only these anchors

New Pandoc distrib = loose cross-references (RMarkdown - knitr - Bookdown - thesisdown - R)

放肆的年华 提交于 2020-12-12 21:35:58
问题 I've loose some cross-references when exporting a bunch of .Rmd files to a single .doc file, using knitr and bookdown (+ yaml). The method is thesisdown::thesis_word:. The problem of loosing-references occurred immediately after I've installed a new version of Pandoc. Maybe I miss a step after Pandoc installation ? The lost references are currently the \@ref(title) ones, which previously return the number of the title indicated by : # My title {#title} and now return (??) . Only these anchors

New Pandoc distrib = loose cross-references (RMarkdown - knitr - Bookdown - thesisdown - R)

核能气质少年 提交于 2020-12-12 21:31:45
问题 I've loose some cross-references when exporting a bunch of .Rmd files to a single .doc file, using knitr and bookdown (+ yaml). The method is thesisdown::thesis_word:. The problem of loosing-references occurred immediately after I've installed a new version of Pandoc. Maybe I miss a step after Pandoc installation ? The lost references are currently the \@ref(title) ones, which previously return the number of the title indicated by : # My title {#title} and now return (??) . Only these anchors

New Pandoc distrib = loose cross-references (RMarkdown - knitr - Bookdown - thesisdown - R)

拈花ヽ惹草 提交于 2020-12-12 21:30:23
问题 I've loose some cross-references when exporting a bunch of .Rmd files to a single .doc file, using knitr and bookdown (+ yaml). The method is thesisdown::thesis_word:. The problem of loosing-references occurred immediately after I've installed a new version of Pandoc. Maybe I miss a step after Pandoc installation ? The lost references are currently the \@ref(title) ones, which previously return the number of the title indicated by : # My title {#title} and now return (??) . Only these anchors

New Pandoc distrib = loose cross-references (RMarkdown - knitr - Bookdown - thesisdown - R)

我只是一个虾纸丫 提交于 2020-12-12 21:29:27
问题 I've loose some cross-references when exporting a bunch of .Rmd files to a single .doc file, using knitr and bookdown (+ yaml). The method is thesisdown::thesis_word:. The problem of loosing-references occurred immediately after I've installed a new version of Pandoc. Maybe I miss a step after Pandoc installation ? The lost references are currently the \@ref(title) ones, which previously return the number of the title indicated by : # My title {#title} and now return (??) . Only these anchors

How to include a header based on a condition in knitr

冷暖自知 提交于 2020-12-10 08:46:25
问题 I have a header followed by a code chunk in an Rmd file. I only want to include this header and the chunk followed by it, if a condition is met. I know how to do that with the chunk, since it's in the body of the code, but how do I do the former? ```{r} print_option <- TRUE ``` ## My header ```{r} if(print_option==TRUE) { print (x) } ``` 回答1: The chunk option eval and asis_output() provide a simple solution. Assuming that print_option is a boolean indicating whether to show the header (and