knitr

Table placement with stargazer and knitr

爱⌒轻易说出口 提交于 2019-12-04 07:39:42
I have a knitr document with a table of regression results as output by stargazer , like so: \documentclass[11pt]{article} \begin{document} <<setup, echo = FALSE, results= 'hide', message = FALSE>>= data(mtcars) library(stargazer) @ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend molestie nisi, id scelerisque orci venenatis imperdiet. Fusce dictum congue faucibus. Phasellus mollis bibendum tellus eu interdum. Nam sollicitudin congue fringilla. Donec rhoncus viverra lorem vel molestie. Ut varius facilisis ante, a pretium arcu feugiat in. Maecenas sagittis accumsan massa

Add X-UA-Compatible in rmarkdown html output

℡╲_俬逩灬. 提交于 2019-12-04 07:02:46
I'm trying to add the following tag <meta http-equiv="X-UA-Compatible" content="IE=edge" /> as the first one after <header> in the output of rmkardown HTML document. This is necessary for Internet Explorer, as explained in this MSDN article . This answer does not work for me because the tag is added at the end of <head> and is ignored. My HTML output has some script embedded that is written before the X-UA-Compatible meta tag. Is there a way to add the tag as the first one automatically in rmarkdown? I just ran into this issue too. As people have said in the comments, editing the template html

How to control plot height/size in interactive RMarkdown (with Shiny)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 06:48:09
I am using Shiny together with RMarkdown to produce an interactive document, as described here . Using the following code, I managed to plot an interactive map ```{r, echo=FALSE, warning=FALSE, message=FALSE} g2g14 <- readOGR("input//geodata", "g2g14") # no projection needs to be specified old_geodata <- g2g14@data inputPanel( selectInput("map.party", label = "Partei", choices = unique(long_data$Partei), selected = "FDP"), selectInput("map.year", label = "Wahljahr", choices = unique(format.Date(long_data$Jahr, "%Y")), selected = "1971") ) renderPlot({ partydata <- long_data %>% filter(Partei =

How can I set the latex path for sweave in R?

两盒软妹~` 提交于 2019-12-04 06:31:24
I would like to know how I can set the pdflatex path in R to use sweave . Because I have 2 different MikTeX installations and one is working properly. Please take into account that I am using R (RStudio) in Windows . I found some suggestion however, for Linux or Unix users. thanks in advance If you have multiple installs of LaTeX (i.e. MikTeX) and you want to use a specific one of these, then you need to make sure that R finds the one you need first. This means that you have to add the location of your preferred version of pdfLaTeX at the front of your PATH system environment variable. If you

With knitr and .Rnw for LaTeX, how do you print the full bibliography in PDF output?

寵の児 提交于 2019-12-04 05:32:47
I can't seem to hack my way through all the possibilities and have a full bibliography inserted in the PDF output of RStudio, knitr , an .Rnw script, and the "Compile PDF" button. The desired text in the PDF would be the details of the cited works. Here is a Lilliputian bibtex file, called jabrefbibtest.bib , saved in the working directory. @Book{GreentargetEngagement2012, Title = {"2012 - In - House Counsel New Media Engagement Survey"}, Author = {"Inside Counsel "}, Publisher = {"Greentarget"}, Year = {"2012"}, Pages = {"20"}, Plots = {"9"}, Tables = {"0"}, Url = {"http://www.greentarget.com

Splitting knitr Chunk code and output into two different knitrouts

烈酒焚心 提交于 2019-12-04 04:46:53
The knitr Chunk option results = "hold" can put the output after the Chunk Code . I wonder how to split knitr Chunk code and output into two different knitrouts possibly with heading of Code and Output . Thanks in advance for your help. \documentclass{article} \begin{document} << label=Test, results = "hold" >>= 1:100 args(lm) @ \end{document} Desired Output Code 1:100 args(lm) and Output [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 [55] 55 56 57 58 59 60 61 62 63 64 65 66

rmarkdown: how to use multiple bibliographies for a document

只谈情不闲聊 提交于 2019-12-04 04:20:02
[My environment: Win 7 Pro / R 3.2.1 / knitr_1.12.3 / R Studio Version 0.99.892] I am trying to write an article in .Rmd format using R Studio, Knit -> PDF, and I've been following http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html for details of how to get pandoc and pandoc-citeproc to produce a References section and citations in the text. My BibTeX references are in several different .bib files, which, when using LaTeX in .Rnw files, are all found in my local texmf tree via \bibliography{statistics, graphics} I can't seem to make this work with pandoc-citeproc . My

Rmd to PDF compiling error: Package geometry \paperwidth (0.0pt) too short

痴心易碎 提交于 2019-12-04 03:44:05
问题 I am writing a paper in R markdown and need to format it with this .cls file supplied by an academic journal. A minimal .tex file compiles perfectly well with the above cls file. My .tex file (compiled on ShareLaTeX with clv3.cls saved in same directory): \documentclass[shortpaper]{clv3} \usepackage[utf8]{inputenc} \title{Paper title} \author{Name Surname} \date{May 2018} \begin{document} \maketitle \section{Introduction} Some text. \end{document} However a comparable minimal document in R

Set page width in Knitr for md or HTML output

十年热恋 提交于 2019-12-04 03:25:18
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 resize either .md page width or direct pander to output a page with auto-width settings (adjusting to a

In knitr, no output from pander in for loop

假装没事ソ 提交于 2019-12-04 03:19:57
Using knitr in RStudio, pander does not produce any (or correct) html output when in a for loop. Here is a minimal case, as an Rmd input file. --- title: "Untitled" output: html_document --- Testing why pander doesn't work in for loop ```{r global_options, include=FALSE} knitr::opts_chunk$set(fig.width=7, fig.height=5, echo=FALSE, warning=FALSE, message=FALSE) ``` ```{r} library(pander) r <- 1:10 print("pander at top level") pander(summary(r)) # works print("pander in for loop") for (i in 1:2) pander(summary(r)) #does not work (nothing in output) for (i in 1:2) print(pander(summary(r))) #does