knitr

rmarkdown::render_site() Error in rmarkdown::render_site() : No site generator found

旧城冷巷雨未停 提交于 2019-12-10 02:52:38
问题 I am trying to knit together 3 files using this example: http://rmarkdown.rstudio.com/rmarkdown_websites.html My files all share the same directory, which has been set in the RStudio build options. I literally copied the YML from the examples with my own file names. Even if I copy the examples directly, I get the same error. I even ran the site_generator function from the RMarkdown Github: https://github.com/rstudio/rmarkdown/blob/master/R/render_site.R#L157 I noticed there are options for

xtable in .Rmd then knit as pdf in rstudio shows % comments

妖精的绣舞 提交于 2019-12-10 02:28:57
问题 I am making a PDF using Rstudio's 'knit PDF' option when writing an R Markdown (.Rmd) file. When creating a table using the xtable function, text commented in latex using the % is displayed in the pdf. This problem goes away when knitting a .Rnw file using latex and R. Below the is an example of an .Rmd file to be knitted as PDF and the equivalent .Rnw file, to knitted (as pdf, naturally). Their PDF results are identical, except for one line. Just above the table, the following is displayed:

How to control knitr kable scientific notation?

送分小仙女□ 提交于 2019-12-10 01:54:46
问题 I have a data frame like this: > summary variable value 1 var1 5.810390e-06 2 var2 5.018182e-06 3 var3 5.414286e-06 4 var4 3.000779e+02 5 var5 -2.105123e+01 6 var6 8.224229e-01 I want to print it in a word document using knitr/kable. Thus I used the following function: knitr::kable(summary, row.names = FALSE, col.names = c("Variable", "Mean")) But the result is not satisfying: I'm OK with variables 4 to 6, but variables 1 to 3 are really not easy to read this way... Is there a way to control

Specifying multiple simultaneous output formats in knitr (new)

試著忘記壹切 提交于 2019-12-10 01:02:55
问题 Can I write a YAML header to produce multiple output formats for an R Markdown file using knitr? I could not reproduce the functionality described in the answer for the original question with this title. This markdown file: --- title: "Multiple output formats" output: pdf_document: default html_document: keep_md: yes --- # This document should be rendered as an html file and as a pdf file produces a pdf file but no HTML file. And this file: --- title: "Multiple output formats" output: html

Unexpected behavior of kable when called from lapply or from function with print statement

拟墨画扇 提交于 2019-12-09 16:53:33
问题 I am trying to understand the two following unexpected behaviors of the kable function when knitting HTML using the knitr package (in RStudio 0.98.977 on Ubuntu 14.04): When two calls of kable are made from within lapply, only the first call produces a pretty display in the final HTML. When two calls of kable are made from within a function that also uses print statements, only the last call produces a pretty display in the final HTML. An example code is written below: Load library: ```{r

Set page width in Knitr for md or HTML output

倖福魔咒の 提交于 2019-12-09 16:33:42
问题 I am having knitr to create an output of my statistical analysis along with figures. My analysis has a number of levels that are marked by headers. To get the nice html page with table of contents on the side I use "pander" (pandoc R package) to convert my .md file to html because knitr does not embed table of contents in the html file. The problem: When I use pander it creates a fixed width page (quite narrow) where my large figures need to be scrolled left and right. Is there any way to

change code block color in knitr/markdown

非 Y 不嫁゛ 提交于 2019-12-09 15:54:05
问题 I'm working on a markdown document in Rstudio that compares Perl and R. What I'd like to be able to do is have different code block background colors depending on the language used. For example R code block ```{r} dog <- 1 cat <- 2 dog + cat ``` Perl code block ```{r, engine='perl'} $dog = 1; $cat = 2; print $dog + $cat; ``` If you generate an html file using knitr with the above code, the r code block has a solid grey background while the output from the code block has a white/transparent

RStudio knitr themes

心已入冬 提交于 2019-12-09 15:14:18
问题 I've just started playing with some of the new knitr features in RStudio. I've tried selecting several of the different themes in the R Markdown settings dialogue but these don't seem to have any noticeable impact on the style of my resulting document. Should it, or am I missing something? Everything just seems to come out in the default style no matter what theme I select. --- output: html_document: number_sections: yes theme: spacelab toc: yes pdf_document: default word_document: default --

Referencing a 'hand-made' table using bookdown package

浪尽此生 提交于 2019-12-09 14:36:33
问题 I'm trying to reference a table using the bookdown package. In the documentation for tables, the author only shows how to create tables using knitr::kable . ```{r table1} knitr::kable( head(iris, 20), caption = 'Here is a nice table!', booktabs = TRUE ) ``` Table \@ref(tab:table1) is here. Using knitr::kable works just fine. The caption of the table is displayed and I can reference the table. I would like to do the same with a classic, hand-made markdown table, but obviously the code below

Conditional formatting of a table in RShiny

送分小仙女□ 提交于 2019-12-09 11:39:40
问题 I'm trying to visualize a cohort analysis, and wanted to use RenderDataTable in shiny to get this sort of a visualization where I would be able to highlight all the cells based on a separate column having values 1/0, with 1 being shaded and 0 not being shaded. I Tried a couple of things, including trying to use geom_tile in ggplot2 , but it was of no avail. I also tried looking at rpivotTable , but I wasn't able to figure out how to shade certain cells. Example Data: df <- " cohort wk value