r-markdown

Printing linebreaks in HTML kable table

▼魔方 西西 提交于 2019-12-24 11:41:40
问题 When creating tables using kable , is there a way to generate a line break (ie < br > ) when string in a data.frame ' dt' has \n ? For example, here: library(data.table); dt <- fread("https://s3.amazonaws.com/assets.datacamp.com/blog_assets/prince_raw_data.csv") dt <- dt[301:303,2:6] #take three songs only library(knitr); library(kableExtra) kable(dt); # use this line to view it: dt %>% kable %>% kable_styling() This relates to Automated nicely formated book of lyrics from data.frame using

Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 Execution halted

佐手、 提交于 2019-12-24 11:36:12
问题 I am new to R and have been trying to write my project report in R markdown. However I am facing issues. I tried implementing solutions present on stack overflow as well as other websites, but I have not been able to make progress. Details: R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" RStudio Version 0.99.441 – © 2009-2015 Mac OS X Yosemite version 10.10.5 Installed pandoc 1.15.0.6 https://github.com/jgm/pandoc/releases/tag/1.15.0.6 The MacTeX-2015 Distribution from http://tug.org

How to change the font colour used inside the chunks when building a tufte book using bookdown?

℡╲_俬逩灬. 提交于 2019-12-24 11:27:38
问题 I am trying to build a book, with 9 chapters. I am using the bookdown::bookdown_site package for that, which I have included in the YAML header in index.Rmd. But when I knit the book, using bookdown::tufte_book2, the pdf file generate the text inside the chunks with different font colors. When I try to run each chapter individually, using "tufte_handout", the outcome is as expected. Main text and inside chunk text is monochrome and TimesNewRoman. In rStudio, before build the book, I have

Programmatically generating formatted text in R markdown

久未见 提交于 2019-12-24 11:27:33
问题 I am fairly new to R markdown (and R itself). I am using RStudio to create an R Markdown file. I would like to create a report that has several different plots across different time windows, each with accompanying text. Something like this: for (i in seq(0, max)) { # generate some text with markdown formatting including the value of i } I know that it is possible to embed R values inline in markdown text. Is there also a way to generate markdown text inline within R code? 回答1: Probably Pander

cross-reference to figure in R Markdown with html output is not working

落花浮王杯 提交于 2019-12-24 11:09:01
问题 I would like to show a nice cross-reference to a picture in the HTML document I'm creating with R Markdown. However, even if I followed the bookdown section on cross-references, I cannot get the reference to show in the final HTML output. I'm working in R Studio, if that helps. .Rmd file: --- title: "ppp" author: "ppp" date: "July 4, 2017" output: html_document: fig_caption: yes --- ```{r setup, include=FALSE} library(knitr) opts_chunk$set(echo = FALSE) ``` ```{r foo, fig.cap="$f_{p}$ as a

natbib seems to not work properly with pdf_book / rticles

China☆狼群 提交于 2019-12-24 10:57:07
问题 In my .Rmd file, I refer to position in .bib file as follows: "Let me cite an article: [@SampleTitle2016]" When I 'knit the current', I would like to have .tex file where citations to articles are provided by \cite, \citep or \citet command. I noticed that if I omit the line 'citation_package: natbib' in output params, citations are provided as a raw text: However, If add mentioned line, .tex file looks better, but for some reason, bibliography is unable to properly display / (compile?) - I

In r studio, how does the IDE treat notebooks with the 'preview' button

最后都变了- 提交于 2019-12-24 10:54:01
问题 I am building a custom formatted notebook using some css and html. As recommended this is implemented using a wrapper function around an rmarkdown function. quarterly_report <- function(toc = TRUE) { # get the locations of resource files located within the package css <- system.file("reports/styles.css", package = "mypackage") header <- system.file("reports/quarterly/header.html", package = "mypackage") # call the base html_document function rmarkdown::html_notebook(toc = toc, fig_width = 6.5

Set/change bibliography title in RMarkdown?

坚强是说给别人听的谎言 提交于 2019-12-24 10:47:52
问题 I'm currently experimenting with RMarkdown. However, I would like to change the title of my bibliography. I'm using natbib in this situation. The current RMarkdown setup is shown below: title: .... author: .... output: pdf_document: citation_package: natbib bibliography: Referanser2.bib biblio-style: unsrt header_includes: - \usepackage{amsmath} - \usepackage{kbordermatrix} - \setcitationstyle{numbers,square} [@MyReference] This gives me a simple PDF with 1 reference and a bibliography. Is

Issues plotting multiple plots in a single figure within RMarkdown

 ̄綄美尐妖づ 提交于 2019-12-24 10:35:58
问题 I have plot function that produce four plots like glm. A histogramm, a boxplot and two scatterplots. But I cant put them in the right place in my document so that I can see all informations. I want 2 plots in 1 row and to be wide so I can see all informations like header etc. It's senseless to post my plot function, because it's for a class that I created. My output looks always like this I have the following YAML layout: --- title: author: fontsize: 11 graphics: true documentclass: article

rendering equations as images and including them in Word/PowerPoint output documents with R Markdown

蓝咒 提交于 2019-12-24 10:30:02
问题 I'm gratuitously cross posting this from the R Studio community page as this is a bit esoteric. Is there a way to ask Knitr to render my equations from R Markdown into images and then stick the resulting images into my final document? The use case I have in mind is overcoming some of the shortcomings of MSFT Equation editor when knitting to Word/PowerPoint. If the equation was simply an image, then I could have LaTeX quality equations in my MSFT docs, which would be fabulous! The closest