r-markdown

how to align stargazer table to the left when type=“latex”?

北城余情 提交于 2019-12-23 12:50:49
问题 I use stargazer package in my automated rmarkdown pdf documents to make nice looking tables. Stargazer places its tables in the center of the page, by default. How can I let stargazer generate latex code that aligns the table to the left? here is an example of what I mean: library(stargazer) data_object <- structure(list(test = structure(c(1L, 1L, 2L, 2L), .Label = c("test1", "test2"), class = "factor"), test2 = structure(1:4, .Label = c("1", "2", "3", "4"), class = "factor")), .Names = c(

r - rmarkdown - render list of dataframes

此生再无相见时 提交于 2019-12-23 12:26:20
问题 Is it possible to render a list of data frames in a markdown document as individual tables? Example Given the code chunk ```{r listOfDf} library(knitr) df <- data.frame(a=rnorm(10),b=rnorm(10),c=c(rep("a",5), rep("b",5))) l_df <- split(df, df$c) kable(l_df) ``` This outputs But I would like something closer to that given in the R console: > l_df $a a b c 1 1.2869909 -0.3117932 a 2 1.4621792 1.2826924 a 3 -0.4274641 0.3335532 a 4 0.7882973 -1.1966702 a 5 -1.2086910 0.1549691 a $b a b c 6 -0

RMarkdown: Floating TOC and TOC at beginning

微笑、不失礼 提交于 2019-12-23 12:16:35
问题 I was wondering if it is possible to have a floating table of contents and another one at the beginning of the document. My current front-matter looks like this: --- title: "TEST" author: brettljausn date: January 15, 2018 output: html_document: toc: true toc_float: toc_collapsed: true toc_depth: 3 number_sections: true theme: lumen --- # Rest of the sample document: -------- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # R Markdown This is an R Markdown document.

How to get headings sans serif while preserving pdf bookmark text?

て烟熏妆下的殇ゞ 提交于 2019-12-23 12:06:04
问题 In rmarkdown I want headings with sans serif font. I can achieve this with \textsf{} latex command but later in the PDF there's no bookmark text shown. I already tried ## \textsf[Heading 1]{Heading 1} but with an error as result. Anybody got an idea how to get both? MWE: --- output: pdf_document --- ## \textsf{Heading 1} Lorem ipsum dolor sit amet, sit id rebum choro euripidis, nam ei ullum tamquam scaevola, est veniam consulatu et. Duo ex utamur atomorum. His ad dicat pericula, solet

Creating a footer for every page (including first!) using R markdown

你。 提交于 2019-12-23 10:26:57
问题 I'd like to add to the question Creating a footer for every page using R markdown: how do I do this for the first page of the document in addition to all the following pages? In RStudio, this code: --- title: "Test" author: "Author Name" header-includes: - \usepackage{fancyhdr} - \usepackage{lipsum} - \pagestyle{fancy} - \fancyhead[CO,CE]{This is fancy header} - \fancyfoot[CO,CE]{And this is a fancy footer} - \fancyfoot[LE,RO]{\thepage} output: pdf_document --- \lipsum[1-30] Produces this at

How to display chunk output before echoing code in Rmarkdown presentation (slidy)?

我们两清 提交于 2019-12-23 10:26:17
问题 I recently started using the Slidy presentation template in Rmarkdown and like how each slide allows you to scroll down for more content. One way I'm using this is in sharing plots with my students (see example code below). On a single slide I can display the plot along with the exact code used to create the plot which can be viewed by scrolling down. --- title: Echo Code Chunks After Code Results subtitle: Thanks For Your Help author: Me date: "today" output: slidy_presentation runtime:

Reduce spacing between columns in table created with kable(, format = 'markdown')

霸气de小男生 提交于 2019-12-23 10:16:26
问题 I try to create a table using the format "markdown" of the function kable() , but the spaces between the columns are so wide that the table extends over the page. Is there anyway to adjust the cell size so that a table in markdown format does not extend over the page? In latex format it stays within the page, but I do not want this format nor do I want html . I want the output file to be .pdf. I know that a similar question has been asked here, but my question is specific to the format

Reduce spacing between columns in table created with kable(, format = 'markdown')

我的未来我决定 提交于 2019-12-23 10:15:36
问题 I try to create a table using the format "markdown" of the function kable() , but the spaces between the columns are so wide that the table extends over the page. Is there anyway to adjust the cell size so that a table in markdown format does not extend over the page? In latex format it stays within the page, but I do not want this format nor do I want html . I want the output file to be .pdf. I know that a similar question has been asked here, but my question is specific to the format

R CMD build skips knitr/Rmd vignettes - “Output(s) listed in 'build/vignette.rds' but not in package”

て烟熏妆下的殇ゞ 提交于 2019-12-23 10:14:20
问题 I have built an rmarkdown tutorial for an R package, and would like to include the compiled file when the package is built. Though the file compiles happily (including when I use R CMD Sweave to do so), I don't seem to be able to include it in a binary. Specifically, when I run R CMD BUILD I get * checking for file ‘./DESCRIPTION’ ... OK [snip] * installing the package to build vignettes * creating vignettes ... OK * checking for empty or unneeded directories Removed empty directory ‘rentrez

rmarkdown vector graphics for knit word

僤鯓⒐⒋嵵緔 提交于 2019-12-23 07:49:34
问题 When using rmarkdown with knitr in Rstudio to knit a Microsoft Word document, the graphics generally look crappy because the usual vector graphics formats, such as PDF are not supported in Microsoft Word. Fortunately, the devEMF package in R generates the microsoft vector format EMF, and I almost have this working for my rmarkdown application. The problem is that my image is showing up way too small. How can I control the image size? I've tried the standard things below: --- title: "Plot size