r-markdown

How to download multiple reports created using R markdown and R shiny in a zip file

痞子三分冷 提交于 2019-12-07 21:44:30
I have created an R shiny application to download dynamic reports using R Markdown. Previously I was downloading one report at a time by selecting the row in the data table in r shiny and clicking on download button, the selected row's column values would get filled in the report, this was working perfectly fine. But now i am trying to download multiple reports, so that if I select multiple rows in a datatable in r shiny and click on download, the number of reports downloaded should be equal to number of rows selected. For this I am trying to create a zip file which contains all my individual

read_excel read in messages- Suppress?

主宰稳场 提交于 2019-12-07 18:08:39
问题 I love using the readxl package. However, I've been using it as part of an RMarkdown document and some of the read_excel() message when reading in files are useful when doing analysis but not when trying to present the analysis. So the question is, is there any way to suppress the message received (or any warning message for that matter) when using read_excel ? I'll take an RMarkdown OR read_excel solution. Here is an illustration of the type of message I'd like to suppress. The appears in my

How to create a table in Rstudio presentation

给你一囗甜甜゛ 提交于 2019-12-07 18:02:55
问题 I'm trying to create a table in an RStudio .Rpres file. Below is what I have at this point from online searching but the alignment is not correct. Is this the best method? Any suggestions on the alignment? Test ========================================================= | Right | Left | Default | Center | |------:|:-----|---------|:------:| | 12 | 12 | 12 | 12 | | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 | : Demonstration of simple table syntax. Result: 回答1: You can use knitr::kable to print

Change font of Kable in Rmarkdown pdf

拈花ヽ惹草 提交于 2019-12-07 17:09:20
问题 Is there a way to change the font of a kable in Rmarkdown when knitting to pdf? I can find plenty on changing size or bold etc but not on changing the actual font. I would just like something sans serif. Example markdown doc: --- title: "R Notebook" output: pdf_document: default --- Change the font in the table below: ```{r message=FALSE, warning=FALSE, echo=FALSE} library(kableExtra) mtcars %>% head() %>% kable() ``` Default table output font 回答1: You can use the Latex fontspec library, see

How to knit_print flextable with loop in a rmd file

旧时模样 提交于 2019-12-07 15:56:31
I am trying to produce mutltiple tables using the flextable and kable packages. When I want to output some table iteratively, I found knit_print of flextable is not working in loop. Below is a minimal example: --- output: word_document --- ```{r} library(flextable) library(knitr) ``` ```{r} data(cars) speed<-unique(cars$speed) for (v in 1:length(speed)) { carspd<-cars[which(cars$speed==speed[v]),] tb<-regulartable(carspd) knit_print(tb) } knit_print(tb) ``` Just the last knit_print can print the result to the word_document with the .Rmd file. Now I find the difference of them in .md which is

RMarkdown cannot knit: html_dependency not found

守給你的承諾、 提交于 2019-12-07 15:46:28
I am trying to create an html file using RMarkdown (using the sample .Rmd in RStudio). When I click Knit , I am getting the following message: Error: path for html_dependency not found: Execution halted. I have tried uninstalling and reinstalling both R and RStudio, as well as all of the packages required for markdown. I am running the most current version of RStudio (1.1.383), and R (3.4.2), and all of my packages are up to date. This is not my first time using RStudio or markdown, but I have yet to get markdown work on this computer. I have not made any changes to the default markdown file.

Converting Rmarkdown to PDF without RStudio

本小妞迷上赌 提交于 2019-12-07 14:48:02
问题 I would like to convert a *.Rmd to document to PDF without rstudio being available. Current approach Current approach follows the following steps: *.Rmd document is passed to knitr : knit(input = "report.Rmd")) Obtained md is converted via pandoc: # Convert pandoc --smart --to latex \ --latex-engine pdflatex \ -s report.md \ -o report.PDF Problems This results in the following problems, the top section of the Rmarkdown document: --- title: "Report Title" author: "Person" output: pdf_document

RMarkdown - Change Inline Code Color

天涯浪子 提交于 2019-12-07 14:25:00
问题 I am using inline code in RMarkdown and I would like all the text that is a result of inline code to be a different color in the document. In this example, I would like heat.colors to be red all over the document. Is there a way to do this? 回答1: Or you can use text_spec in kableExtra . It literarily does the same thing but just a tiny bit more literal. See more here --- title: '' output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(kableExtra) ``` #

R Markdown horizontal rule that will also work with LaTeX pdf?

試著忘記壹切 提交于 2019-12-07 12:36:52
问题 I am aware that *** is Pandoc's Markdown for a horizontal rule. This horizontal line looks good on HTML, but if I knit my Markdown into a pdf the horizontal rule only runs half the width of the pdf, and it is centered. This combination just makes the horizontal rule look plain ugly. How do I properly put a horizontal rule in my R Markdown that can render properly to both HTML and pdf? Properly == full length/full width . And while I'm at it, can I format the horizontal rule (color, thickness,

Loops in Rmarkdown: How to make an in-text figure reference? Figure captions?

老子叫甜甜 提交于 2019-12-07 12:32:07
问题 {r setup, include=FALSE, message=FALSE, results="hide"} knitr::opts_chunk$set(echo = TRUE) library(knitr) library(kfigr) library(dplyr) library(png) library(grid) library(pander) library(ggplot2) Question Loops in rmarkdown: in-text figure reference? figure captions? Goal Use a for loop to create sections with text, in-text results, and multiple figure references with associated figure captions in the figure list. The figure references/numbering should be seemless with figures numbered before