Questions tagged [r-markdown]

2

votes
1

answer
17

Views

R Position of figures in RMarkdown

I want to knit an article in RMarkdown but the figures (tables) don't appear at the correct position in the document (pdf). Here I can show you my problem in the example data. The table should appear after the appendix: Can someone show me how I can solve this problem? And here is y example code: -...
TobKel
1

votes
1

answer
49

Views

R Markdown PowerPoint Slide Customization

--- title: 'Untitled' author: 'April 2018' date: '4/9/2019' output: powerpoint_presentation --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## Slide with Plot ```{r pressure, fig.width=30, fig.asp=0.618, out.width='200%'} plot(pressure) ``` I'm reading R Studio's guide to cre...
Jason Hunter
1

votes
0

answer
11

Views

R markdown results='hold' but for messages?

I have functions outputting multiple messages in my code and I can't get these messages to be in the same output chunk, like with results='hold'. As of now, the only option that kind of emulates what I want is the collapse=T option, but this sticks the output and the code together, which I don't wan...
Romain B.
1

votes
1

answer
249

Views

Setting section headers in R file that get rendered with spin()

Traditionally I declare section headers in Rmd files like this: # header 1 ```{r, echo=FALSE} print('foo') ``` ## header level 2 ```{r} print('bar') ``` So that when it gets rendered to HTML, it looks like this. And I can put in a table of contents. header 1 foo header level 2 bar Using the spin() f...
Matt H
1

votes
2

answer
914

Views

Stargazer output appears below text - rmarkdown to pdf

The Problem When using rmarkdown in RStudio, my stargazer(glm()) output gets positioned below the text that I would like it to. It gets positioned in a different spot than the r chunk is. The PDF is created perfectly, it's just the position of the stargazer output that is a problem. Background I am...
MillionC
1

votes
1

answer
849

Views

rmarkdown & kable/kableextra: Printing % symbol in Table when using escape = F

I want to create a table in a pdf-document using rmarkdwon and kable. In the header there has to be a linebreak, so to do so i need to set escape = F. The table itself contains percent-values as strings including the % symbol (for example: '13%'). I found here https://tex.stackexchange.com/questi...
TinglTanglBob
1

votes
2

answer
49

Views

Blogdown kable tables formatting (ugly)

kable(head(mtcars) %>% kable_styling(bootstrap_options = c('striped', 'hover')) A normal R Markdown document, utilizing a kable table (see above), is quite striking and looks like this: However, when I use the same code chunk in blogdown, the kable table is printed in a more minimalist fashion, whic...
Jason Hunter
0

votes
0

answer
9

Views

Problems writing code for an R DT summarizing result across multiple studies with collapsable child rows

I'm trying to make an interactive table summarizing the top result of an outcome tested in multiple studies, and I would also like the user to access more detailed results via child rows. Only the 'top' model with the smallest p-value is shown in the main table. Right now I have the relevant result...
alexhli
1

votes
0

answer
264

Views

Knitr ioslides: customize code chunk size

As per this answer and other resources, my understanding is the when setting up CSS for an Rmarkdown presentation, code.r{} should control the parameters for echoed code, while pre{} should control the size of the output. However, pre{} seems to be changing both and code.r{} is doing nothing. Am I d...
Thoughtcraft
1

votes
1

answer
314

Views

I call render to convert R markdown to html, get a Scanner error

question Hi,everyone.(^_^) I have created a new R markdown file(I have not change anything), save to workspace with a name 'test1.Rmd' and then I call render('test1.Rmd'). Immediately, the console show me this error: Error in yaml::yaml.load(string, ...) : Scanner error: while scanning a simple k...
Matthew May
1

votes
1

answer
127

Views

folding sections denoted by headers in rmarkdown

I have been unsuccessful at getting Rmarkdown to fold sections denoted by a #section_header. I know code folding is great, but my goal is to be able to compare results across a number of different analytic pipelines without having to scroll all over the place to find what I am looking for. If I coul...
Nate Y'all
1

votes
0

answer
29

Views

Why does it take up to 30 minutes to import medium size data set into R Markdown

I'm working on a report and I'm using R Markdown. I have a 1.5 GB dataset which takes no time, around 20 sec, to import into R but when importing the dataset into R when using R Markdown it takes around 15 minutes. I'm using read_csv. Is this normal, should I use other function than read_csv?
Viðar Ingason
1

votes
2

answer
374

Views

How can I top align these tables in gtable using grid.arrange?

I have a markdown document using a bit of LaTeX to produce a .pdf with the following chunk: grid.arrange( grobs = list( gtable_combine( gtable_add_grob( tableGrob(mtcars[1:3, 1:2], rows = NULL), grobs = segmentsGrob(y1 = unit(0, 'npc'), gp = gpar(fill = NA, lwd = 2)), t = 1, l = 1, r = ncol(mtcars[1...
DaveRGP
1

votes
0

answer
41

Views

R plots' axis limits reset in Markdown

The plot rendered in R Markdown doesn't use the axis limits I specified in the code. plot(ansX1, ansY1, xlim=c(2,20), ylim=c(2,15)) abline(lm(ansY1 ~ ansX1)) Running this in RStudio generates a plot with the correct axis limits. When rendered in R Markdown, the x-axis limits are [-10,30]. Why does...
Jonathan Brouwer
1

votes
1

answer
383

Views

Looping through data with Rmd input file with flextable results in pandoc version error - but works fine without the loop?

I'm trying to generate lots of word documents with a loop and RMarkdown. I'm using flextable to make the tables with the acceptable formatting for the report. Everything works fine until I try to loop through a dataset. Then I get an error about the pandoc version: Error in knit_print.flextable(x,...
ACC
1

votes
1

answer
496

Views

How to add table caption using df_print?

In rmarkdown (I happen to be using blogdown), if we use a SQL code chunk, a table caption is added with tab.cap in the knitr code chunk. Is there a way to use tab.cap for a R code chunk that prints a tibble using df_print = 'kable' in the YAML. I know that using the kable function directly would wor...
Jordan Farrer
1

votes
0

answer
191

Views

Converting shiny r markdown from downloadHandler to renderUI

I am trying to modify this example to add a pre-visualisation of the markdown report in the main Ui panel but I am not able to pass the parameters correctly using rmarkdown::render. shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel( sliderInput('slider', 'Slider', 1, 100, 50), downloadButton('r...
ulrich
1

votes
0

answer
116

Views

What is the most efficient way of creating a password protected Rmarkdown document online?

Ideally I would be able to present RMarkdown document with the only extra layer being that there is a password prompt before viewers to my link can view it. It would be very useful to be able to password protect class related Rmarkdown documents, but I am unable to find any guidance on the matter.
sinandrei
1

votes
0

answer
231

Views

Math Expression in RMarkdown and Markdown (RStudio)

I was trying to create a technical note in R Markdown with Knit in RStudio. If I output an html file, it works well. However, if I output a Markdown (to be uploaded as a post in blog) file, some formulas cannot be shown correctly. Does anyone know why? Thanks in advance. This is the .rmd file This i...
Math Novice
1

votes
0

answer
165

Views

Can you make R add data to global environment while knitting an R Markdown document?

I am aware that R Markdown cannot reference data within your global environment unless they are part of your R Markdown script (see this question: How to use objects from global environment in Rstudio Markdown). However, I'm confused why Markdown does not add data to my global environment when I kni...
Scott Z
1

votes
0

answer
193

Views

Plotting Octave Plots in RMarkdown

I am trying to knit Octave code in Rmarkdown , it works fine for printing and text based output , but not knitting the plots to html. ```{octave,engine.path='/usr/local/bin/octave/',results='asis',echo= TRUE} x = -10:0.1:10; # Create an evenly-spaced vector from -10..10 y = sin (x); # y is also...
Siddharth Bhatia
1

votes
0

answer
475

Views

Knitr error when running R Markdown from batch

I was following this SO answer to create a batch file that runs an R script, which in turn runs a Markdown file. In short. The test version has three parts. I. R Script - knits and renders the markdown: library(knitr) library(rmarkdown) setwd('~/r_directory') knit('test_markdown.Rmd') render('test...
Prometheus
1

votes
0

answer
15

Views

Rmd add extern .pdf-page to html report

Is it possible to include a specific page of a .pdf to an html-markdown report? This works obviously, but only if the Rmd-report is rendered to .pdf \includegraphics[page=2]{my.pdf} For an html-report, nothing is included. ![my.plot.description](my.pdf) includes the whole pdf as single, scrollable p...
groebsgr
1

votes
1

answer
357

Views

RMarkdown pdf document chunk output exceeds page margins

While I am knitting a document as a PDF using RMarkdown some code chunk outputs exceeds the page margins as seen on the pic. Any ideas to fix this?
Emre Toros
1

votes
0

answer
99

Views

R Markdown / knitr with sql engine - error when creating new table in Oracle database

I am writing a R Markdown file with a sequence of sql chunks. Each chunk contains a CREATE TABLE statement that writes data into an Oracle database. For instance: ```{r setup} library(knitr) library(ROracle) con
Till
1

votes
0

answer
83

Views

How can I submit a batch job knitting an Rscript on LSF?

How to knit an Rmd document in a job on an LSF cluster? I tried this: bsub -q normal -E 'test -e /nfs/users/nfs_c/username' -R 'select[mem>20000] rusage[mem=20000]' -M20000 -o DOWNLOAD.o -e DOWNLOAD.e -J DOWNLOAD Rscript -e 'rmarkdown::render('code/12downloadSeq.Rmd')' The above command does not wor...
charlesdarwin
1

votes
1

answer
190

Views

Formatting R output in an R Markdown documents

I have a code that generates a text output. For example: pick
ulrich
1

votes
1

answer
285

Views

Using R, how can I create an .RTF file containing a table with a merged cell?

I need to create an rtf file with a 'complexe' table inside (in fact I just need horizontal merged cell). I tried the {RTF} package, but the addTable function takes a data.frame or table object without any parameter like colspan .. I tried to use Rmarkdown with rtf_document output, but Rmarkdown doe...
Vincent Guyader
1

votes
1

answer
1.1k

Views

Error while knitting rmd file with ggplot

library(ggplot2) #done this multiple times, and rmd works fine! RIStopData withCallingHandlers -> withVisible -> eval -> eval Execution halted This is the boxplot I get in the markdown after running the code chunk.
Sadanand Wachche
1

votes
0

answer
264

Views

Getting an error when trying to produce pdf table ,using the kableExtra package, after importing csv file in a shiny app

Hello I have this simple shiny app which includes 3 files(ui,server,kable), in which i want to be able to produce a table with kable() after importing a csv file. I can make it work when i produce it in html but it cannot be converted to pdf. Specifically i get this error: Error : pandoc document co...
firmo23
1

votes
0

answer
129

Views

R Markdown: fancyhdr can't set head rule to 0 even after redefining the \headrulewidth command

I'm trying to make a quick thesis document/template, but the documents are not allowed to have a header line, just the page numbers. I can change what exists inside the header and footers (e.g. adding a page number at the top right hand of the page), but the rule won't go away. I tried multiple var...
Alvadine
1

votes
1

answer
807

Views

rmarkdown error: “myfile.tex”' had status 1

I am trying to compile an RMarkdown document from an R script. This is the code I am running: setwd('C:/Users/me/me_VN02_5676/myfolder') rmarkdown::render('myrmd.Rmd', output_file = 'mypdf.pdf') This results in the error: Error: Failed to compile mypdf.tex. In addition: Warning message: running comm...
user3022875
1

votes
0

answer
151

Views

How to output an RMarkdown file (which is run with params) within a Shiny tab

I would like to display an RMarkdown file within a Shiny tab. The problem is that it works only if there are no params explicitly passed to RMarkdown file. The enclosed files correspond to a Shiny app which has 2 tabs: one with a download button (which works as intended), and one which is showing th...
Aex
1

votes
1

answer
167

Views

bookdown chapter heading not correct

I am using the bookdown to write a book. I've defined the documentclass as book. Everything seems to be working correctly - the Table of Contents, List of Tables and List of Figures along with an Appendix, Bibliography and Index. However, in my index.Rmd file I lead off with a Preface section that i...
Melinda Higgins
1

votes
2

answer
134

Views

How to automatically display a matrix from a string in r-markdown?

To show you my problem. The program below should create two same matrices: [A|b]1 and [A|b]2. ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE, warning=FALSE, comment = '', message=FALSE) ``` ```{r} my_string
Kamil
1

votes
1

answer
572

Views

Inline code and inline LaTeX, R Markdown Pandoc error 43

I've run into this issue a couple times now, but whenever I try to include both inline LaTeX and inline R code in my Rmd file, I get Pandoc error 43. Never been able to find a workaround other than just manually adding in what the R code would have been. --- title: 'HW4' date: '2/23/2018' header-inc...
jaylee
1

votes
0

answer
300

Views

Change font for 'Author', RMarkdown

I would like to modify the default font size and color of the 'Author' and 'Date' of a Rmd document. I looked up and tried modifying it using a CSS stylesheet. The font of the 'Title' got modified but I cannot modify the 'Author' and 'Date'. Here is what I tried so far for 'Author'. body{ /* Normal...
data wrangler
1

votes
0

answer
93

Views

Remove default html header tags from flexdahboard

I'd like to use higher version of boostrap 4.0.0 in flexdashboard and refer to desired version using --- title: 'Untitled' output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill self_contained: false includes: in_header: head.html --- ```{r setup, include=FALSE} library(f...
Leni Ohnesorge
1

votes
0

answer
69

Views

Cannot use rmarkdown from RGui

I would like to generate a PDF via RMarkdown from the RGui. I am able to knit the file via RStudio but it fails every time via RGui. This is 'essai.r' file that contains the render command. library(rmarkdown) library(knitr) Sys.setenv(RSTUDIO_PANDOC='C:/Program Files (x86)/Pandoc') rmarkdown::render...
user1752610
1

votes
0

answer
264

Views

Error generating PDF with RMarkdown

I just bought a new Mac. I've cloned my git repo onto it, and ran the following, which worked fine on the old Mac: rmarkdown::render(input = 'statement.Rmd', output_format='pdf_document', output_file = paste(Payees$Payee[i], 'identifying text', i, '2018_02', '.pdf', sep=''), output_dir = '~/Desktop/...
Steve

View additional questions