r-markdown

R markdown citation identifiers

狂风中的少年 提交于 2019-12-12 23:19:52
问题 R markdown allows specifying a bibliography file using the bibliography metadata field in a YAML metadata section. For example: --- title: "Sample Document" output: html_document bibliography: bibliography.bib --- The bibliography may have multiple formats in addition to BibTeX, such as RIS, EndNote, XML, ISI, MEDLINE, and others. The problem is that all usage examples use BibTeX. For example: @article{ahu61, author={Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa}, title={Constraint

In an R Markdown document, “includes” for docx output?

时光毁灭记忆、已成空白 提交于 2019-12-12 22:57:41
问题 In the .Rmd below I have includes: in_header: for pdf output and includes: before_body: for docx output. Is there something analogous for docx output? My current hack is to include the <!--- For DOCX Only ---> code chunk conditionally when producing docx output. But I'd prefer not to have this clutter up the body of my .Rmd and move it out into some sort of preamble-word.tex file. tinytextest.Rmd --- title: "TinyTeX Test" author: "Me" date: "5/3/2019" output: word_document: default html

Replace categorical values with traffic light colors

人盡茶涼 提交于 2019-12-12 22:44:50
问题 I have some categorical values I want to show in a table as red, yellow and green spots in R or r-markdown. Is there a way to do this? maybe an icon package that will let me gsub text for an Icon? I have scoured the internet and come up empty handed. Any thoughts are appreciated. library(kableExtra) dt <- mtcars[1:5, 1:6] kable(dt) %>% kable_styling(full_width = F, font_size = 12) %>% row_spec(0, angle = -90)%>% row_spec(1:5, bold = F, color = "black") 回答1: Here's an example that uses html

knitr .Rmd -> Word document: control details of figures

喜夏-厌秋 提交于 2019-12-12 22:24:58
问题 I'm producing a solutions manual for a book, using .Rmd files with the following YAML header: --- title: "DDAR: Solutions and Hints for Exercises" date: "`r Sys.Date()`" output: word_document: reference_docx: solutions-setup.docx --- where I control the general layout of the document with the reference_docx to get an output Word document. There will be many figures, and I'd like to set some global graphics parameters to give relatively tight bounding boxes and reasonable font sizes in the

R Notebook/Markdown does not save chunk plots using “fig.path = ” chunk option

♀尐吖头ヾ 提交于 2019-12-12 22:19:38
问题 I'm running an analysis in an R Notebook and I would like all plots created in R chunks to be saved as individual PDF files in addition to appearing in the .nb.html notebook output. The problem The problem I'm having is that, when the notebook is run, it does not save plots to the dir specified in the chunk option fig.path = "figures/" either when specified in the individual chunk header: #```{r fig.path = "figures/"} plot(x, y) #``` or when specified with the global chunk options: #```{r

Knitr pandoc Execution halted in R

可紊 提交于 2019-12-12 18:30:31
问题 Knitr / Rmarkdown Execution halted When I run Knitr and Rmarkdown, even with the knitr example scripts, I get the below error message . Error in system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) : '"C:/Program Files/RStudio/bin/pandoc/pandoc"' not found Calls: <Anonymous> ... get_pandoc_version -> with_pandoc_safe_environment -> force -> system Execution halted I have installed and loaded knitr and rmarkdown from the libraries and alternatively using dev tools to get the most

r - leaflet heatmap in rmarkdown

馋奶兔 提交于 2019-12-12 16:42:07
问题 Question Can you plot a leaflet heatmap in an rmarkdown document? Example working code This code will generate a leaflet map with a heatmap when run directly from R library(rCharts) ## data dat <- data.frame(Longitude = c(-122.3809, -122.3269, -122.3342, -122.2984, -122.3044, -122.2754), Latitude = c(47.66796,47.63436,47.57665,47.71930,47.60616,47.55392), intensity = c(10,20,30,40,50,300)) ## create JSON for heatmap ## - could also use jsonlite::toJSON j <- paste0("[",dat[,"Latitude"], ",",

In R is there any way to send an RMarkdown v2 html file as the body of an email

自闭症网瘾萝莉.ら 提交于 2019-12-12 13:52:48
问题 I have developed a report that makes heavy use of the features in RMarkdown v2, especially the feature to add css classes and id's to html documents in order to have greater control over the output using style sheets. I wish to send these reports in the body of an email. I have been trying to do this using send.mail (mailR). According to their gitgub readme file (https://github.com/rpremraj/mailR/blob/master/README.md) mailR does not currently support resolving inline images encoded using the

pkgdown vignette code chunk spacing

核能气质少年 提交于 2019-12-12 13:08:21
问题 I'm having issues with code chunk output when running pkgdown::build_site() with all default options. Chunks are rendered in html content with superfluous white space in between every line of code. For example: ```{r, message = FALSE} library(leaflet) leaflet(toronto) %>% addProviderTiles(providers$CartoDB.Positron) %>% addPolygons() ``` Comes out as: library(leaflet) leaflet(toronto) %>% addProviderTiles(providers$CartoDB.Positron) %>% addPolygons() Or, in screenshot form: I haven't faced

How to collapse groups of row values within a table using formattable?

冷暖自知 提交于 2019-12-12 13:02:17
问题 I am interested in using tools within the formattable R package, but I want to only shows in the table where there is a change. That is, I want hierarchical row labeling that is offered in the kableExtra package via the collapse_rows() function. For example, using kable() and kableExtra , I can do this: library(dplyr) library(knitr) library(kableExtra) iris %>% group_by(Species) %>% slice(1:2) %>% select(Species, everything()) %>% kable() %>% collapse_rows(1, valign="top") to produce this: