r-markdown

Rotating a table in PDF output from RMarkdown with more than one page

半腔热情 提交于 2021-01-28 12:01:18
问题 I want to rotate a wide table in my PDF output. I came across this fantastic question, but my table is longer. When I copy/paste one of the examples shown in that question, it works nice using RMarkdown. library(kableExtra) kable(iris[1:5,], format = "latex", booktabs = TRUE) %>% kableExtra::landscape() However, if we remove the subsetting we see that the table exceeds the dimension of the page. library(kableExtra) kable(iris, format = "latex", booktabs = TRUE) %>% kableExtra::landscape() So

Manually indent references in an R Markdown document

廉价感情. 提交于 2021-01-28 10:40:38
问题 I am trying to manually indent references in an R Markdown document. It is for a CV and includes things that I don't presently have in BibTeX format. Here is an example: --- title: "Untitled" author: "Joshua Rosenberg" date: "10/20/2018" output: pdf_document: default html_document: default --- ### Journal Article \begingroup \setlength{\parindent}{-0.2in} \setlength{\leftskip}{0.2in} \setlength{\parskip}{8pt} Blois, M. S. (1958). Antioxidant determinations by the use of a stable free radical.

RStudio: Disable output of a code in Source Window while writing RMarkdown Document

浪子不回头ぞ 提交于 2021-01-28 09:27:18
问题 I recently updated my RStudio and while writing an R Markdown document in the Source Window, whenever I run a code in a chunk of the RMD, the output is shown in the source window itself in the following manner. It gets too messy when there are huge plots. Would like to disable this feature if possible and revert back to good old style of displaying output in the Console/Plot viewer window only. Output executed and visible below the Chunk in the Source Window Thanks 回答1: Try this in Rstudio.

Exporting and opening CSVs using .rmd file in R

六眼飞鱼酱① 提交于 2021-01-28 08:01:25
问题 I'm working on code in R that formats and creates data frames that I want to share using a .rmd file. In my code, I use write.csv and file.show to create and open CSV files of the formatted datasets. Since we are using .rmd to show the code I wrote for formatting, I was wondering if there's a way to also have write.csv and file.show run when someone opens the .rmd file? I've looked around Google and RStudio to see if 1) this is even possible and 2) if it is possible, how to do it, but I haven

Add image before bookdown title

三世轮回 提交于 2021-01-28 05:26:09
问题 I'm trying to add an image before the title in gitbook style bookdown project. This is similar to this question from the RStudio Community page, but I would like the image to appear only before the title, not every top-level heading. I've created a reprex here: https://bd-reprex.netlify.app/ I've edited the _output.yml to include: bookdown::gitbook: ... includes: before_body: assets/logo.html However, as can be seen in the example above, the image now appears before every chapter, not just

Rnotebook not showing code output for data frames

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 03:16:29
问题 My code chunk output in Rnotebook is not appearing (as if not being run) when I try to view data frame results. I have to pass it through the pander() function to see the output print out. Is this something to do with knitr? I mention this because I set the options at the beginning to the following: ```{r setup, include = FALSE} knitr::opts_chunk$set(echo = TRUE, eval = TRUE) ``` I have tried setting the options directly in the chunk but get the same unwanted result. Is there a setting I am

avoid “pandoc document conversion failed with error 61” for `github_document`

无人久伴 提交于 2021-01-28 03:10:35
问题 I keep failing to knit a github_document because of the error shown below. A solution to avoid this was provided in this question for html_document . But that argument is not available for github_document , and so I am wondering if there is another solution to avoid this error. Error details: "C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS README.utf8.md --to gfm --from markdown+autolink_bare_uris+tex_math_single_backslash --output README.md --standalone --webtex --template "C:

Changing the latex_engine gets an error when trying to align images on kable

元气小坏坏 提交于 2021-01-28 02:22:16
问题 I am trying to copy the first answer in this question. The answer really meets what I wanted. But it get an error when the latex_engine is xelatex. But I really needs to show the output in chinese. Here's the code --- title: "Untitled" output: pdf_document: latex_engine: xelatex --- This example highlights the issue I am having with formatting a nice table with the graphics and the vertical alignment of text. ```{r echo=FALSE, results='hide', warning=FALSE, message=FALSE} ## Load modules

How to display ggplotly plots with dynamically created tabs and for-loops?

可紊 提交于 2021-01-27 20:03:27
问题 I have R markdown document and I want to dynamically create tabs with ggplotly graphics inside them --- output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} library(ggplot2) library(plotly) ``` ```{r} fig=ggplot(cars)+geom_point(aes(speed, dist)) ``` # level 1 ## level 2{.tabset .tabset-pills} ```{r echo=FALSE, results='asis'} for (h in 1:3){ cat("###", h,'{-}', '\n\n') ggplotly(fig) cat( '\n\n') } ``` I understand that it is different from

.Rmd posts do not render in Blogdown using 'wowchemy/starter-academic' in multilingual configuration

无人久伴 提交于 2021-01-27 18:31:32
问题 I installed via Rstudio a Blogdown using 'wowchemy/starter-academic' theme (aka hugo-academic). I changed to put the multilingual configuration in language.tom . And I put the initial folders home and post in the folders content/en and content/es [en] languageCode = "en-us" contentDir = "content/en" # Uncomment for multi-lingual sites, and move English content into `en` sub-folder. # Uncomment the lines below to configure your website in a second language. [es] languageCode = "es-ES"