r-markdown

How to split kable over multiple columns?

喜你入骨 提交于 2019-12-10 14:14:38
问题 I am trying to produce a "longitudinal" layout for long tables in RMarkdown with kable . For example, I would like a table to be split over two columns, like in the example below: dd <- data.frame(state=state.abb, freq=1:50) kable(list(state=dd[1:25,], state=dd[26:50,])) However, this hack produces an output that looks a way worse than the normal kable output (for example the header is not in bold). Is there a "proper" way to do this using kable ? 回答1: kable is a great tool, but has limits.

Blogging with jekyll, rmarkdown and github: how to display images

时间秒杀一切 提交于 2019-12-10 13:58:26
问题 I try to do a blog using the trio jekyll, rmarkdown and github (as here: http://yihui.name/knitr-jekyll/) I have all my .Rmd in _source, and I have this issue that sometimes the plots are knit in base 64 images and sometimes saved in a figure folder. First question, why? Second question: when my plot are saved as images, the path in the html appear to be figure/source/. Knowing that the destination folder is /blog/ (my baseurl in _config.yml), to make it work, it should be blog/figure/source.

Adjusting figure margins in Rmarkdown

穿精又带淫゛_ 提交于 2019-12-10 13:54:27
问题 I am trying to adjust the piechart figure in my Rmarkdown document so that it spans the width of the page or at least becomes wide enough to fit all of the labels. I have tried everything - adjusting figure.height and figure.width , margins with par(mar) and par(oma) , but nothing seems to work. Either the pies themselves become smaller, or the labels are even more cut off. I would like the pies to be as large as possible with clearly visible labels, but every time it renders small pies and

How to suppress all messages in knitr/ Rmarkdown?

前提是你 提交于 2019-12-10 13:32:31
问题 I have used dplyr for some of the analyses and for a particular code it takes about 30 seconds to complete the operation. In the resulting HTML I get a very long output of something like this (reproducing last few lines): |================================================ |100% ~0 s remaining |================================================ |100% ~0 s remaining Completed after 35 s I don't want this to show in the output. How can I suppress this? Is there anythink in the global chunk options

rmarkdown: specify manually pandoc path?

我的梦境 提交于 2019-12-10 13:29:41
问题 I have a rmarkdown document that I render regularly with rmarkdown::render It works fine on my computer (Windows) as I have RStudio installed, and it has setup automatically the path to pandoc. However when I try to run it on my server (outside RStudio), it fails with error that pandoc is not found. How can I set up manually the path the pandoc from my script? Without changing the configuration on the server. I have tried this but it doesn't work: Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC

RMarkdown utf-8 error on mutliple operating systems

爱⌒轻易说出口 提交于 2019-12-10 13:22:54
问题 We have a problem using RMarkdown on multiple operating systems. Initially, an .Rmd file is created on a Linux system (Ubuntu 12.04 LTS) and then pushed to a GitHub repo. It can be compiled ("knitted") without problems on this system. It is then pulled on a Windows 7 machine with RStudio installed. There, when trying to compile, the following error shows up: Error in yaml::yaml.load(front_matter) : Reader error: invalid leading UTF-8 octet: #FC at 66 Calls: <Anonymous> -> parse_yaml_front

Respecting global options in knitr

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:12:10
问题 I am having trouble with setting global options in my R Markdown documents. A simple example follows. In this case I've attempted to set global.par = TRUE . The expectation is that any par() specifications I make in one chuck are carried into subsequent chunks. However, this is not happening. ```{r package_options, include=FALSE} knitr::opts_knit$set(global.par = TRUE) ``` ```{r} lambda <- 0.2; n <- 1000 exp <- rexp(n, lambda) par(cex = 0.7) hist(exp) ``` ```{r} lambda <- 0.02; n <- 1000 exp

Change color of error messages in RMarkdown code output (HTML, PDF)

巧了我就是萌 提交于 2019-12-10 12:51:42
问题 Is there a way to automatically make text color of errors red in R Markdown without manually editing the HTML later. --- title: "" --- #### Example 1 ```{r e1, error = TRUE} 2 + "A" ``` #### Example 2 ```{r e2, error = TRUE} 2 + 2 ``` In the above code, output of Example 1 would have to be red. Currently, I edit the generated HTML (add style="color:red;" to the appropriate tag) but I am wondering if there is an automatic way. Assume that it is not known before knitting whether the code will

How to solve this error message in rmarkdown?

送分小仙女□ 提交于 2019-12-10 12:43:22
问题 I am just starting to explore the rmarkdown package. I don't use Rstudio . I use the default R environment. What I did was as follows. I created a new R document. Started typing few lines in rmarkdown format. Saved the file with Rmd extension. I saved the file in the working directory. I installed the pandoc using the pkg file. I installed 'rmarkdown' package. Loaded the package. Used the following command to render the Rmd file. rmarkdown::render("Untitled.Rmd") I get the following error.

Create reactive selectInput - flexdashboard with Shiny

北战南征 提交于 2019-12-10 12:11:45
问题 I'm trying to make a reactive selectInput using Shiny in a flexdashboard document. My first selectInput selects the type of Zone in a Marine Park. selectInput("Zone", label = "Marine Park Zoning:", choices = c("All", levels(EoTR$MarineParkZone)), selected = "All") Then I use this input to create a reactive data frame with only the Zones selected in step 1. zone.choices = reactive({ if (input$Zone=="All"){ select(EoTR, ReefName, MarineParkZone, MarineParkMgmtSection) }else{ select(EoTR,