sweave

Get rid of \\addlinespace in kable

眉间皱痕 提交于 2019-11-27 01:44:00
In a knitr/Sweave report, the kable function of knitr with the option booktabs=TRUE adds a \addlinespace each fifth line: P1 & A & 10 & 11.016181 & 110.16181 & 44.95101 & 269.9745\\ P1 & B & 10 & 8.592386 & 85.92386 & 35.06083 & 210.5743\\ P1 & A & 100 & 120.610305 & 120.61031 & 58.61274 & 248.1857\\ P1 & B & 100 & 94.990728 & 94.99073 & 46.16245 & 195.4671\\ P2 & A & 1000 & 698.097191 & 69.80972 & 37.34843 & 130.4846\\ \addlinespace P2 & B & 1000 & 837.649249 & 83.76492 & 44.81452 & 156.5690\\ P2 & A & 10000 & 10356.365176 & 103.56365 & 49.47422 & 216.7883\\ P2 & B & 10000 & 10214.989594 &

General guide for creating publication quality tables using R, Sweave, and LaTeX

孤人 提交于 2019-11-26 23:50:18
问题 There are a range of tools available for creating publication quality tables using R, Sweave, and LaTeX. In particular, there are helper functions like latex in the Hmisc package, and xtable in the xtable package. I've also often written my own code so that I could have complete control over table formatting (e.g., see this example). However, when preparing publication quality tables a range of issues often arise: how and when to apply numeric formatting how to precisely control alignment of

Putting line number for R code with knitr

我与影子孤独终老i 提交于 2019-11-26 22:23:33
问题 I wonder if there is any function to put line numbers with knitr in .Rnw . I found this discussion and some documents (now removed from the web) but could not find the way to put line numbers. 回答1: This solution uses the LaTeX listings package to create line numbers. I can only get them to work by accumulating across all code chunks, but I imagine there is a similar solution that will enumerate lines only within each chunk. Here's the .Rnw source: \documentclass{article} \usepackage{listings}

Run Sweave or knitr with objects from existing R session

痴心易碎 提交于 2019-11-26 13:04:11
问题 Suppose I have an object x in my current session: x <- 1 How can I use this object in an Sweave or knitr document, without having to assign it explicitly: \\documentclass{article} \\begin{document} <<>>= print(x) @ \\end{document} Reason I am asking is because I want to write an R script that imports data and then produces a report for each subject using an Sweave template. 回答1: I think it just works. If your Sweave file is named "temp.Rnw", just run > x <- 5 > Sweave("temp.Rnw") You'll have

Get rid of \addlinespace in kable

此生再无相见时 提交于 2019-11-26 11:12:57
问题 In a knitr/Sweave report, the kable function of knitr with the option booktabs=TRUE adds a \\addlinespace each fifth line: P1 & A & 10 & 11.016181 & 110.16181 & 44.95101 & 269.9745\\\\ P1 & B & 10 & 8.592386 & 85.92386 & 35.06083 & 210.5743\\\\ P1 & A & 100 & 120.610305 & 120.61031 & 58.61274 & 248.1857\\\\ P1 & B & 100 & 94.990728 & 94.99073 & 46.16245 & 195.4671\\\\ P2 & A & 1000 & 698.097191 & 69.80972 & 37.34843 & 130.4846\\\\ \\addlinespace P2 & B & 1000 & 837.649249 & 83.76492 & 44

Can Sweave produce many pdfs automatically?

喜你入骨 提交于 2019-11-26 10:29:34
问题 I analyze measurements from many cities (hundreds), and need to create separate reports per city (in Adobe pdf-format). My process is like this: First RStudio to prepare the data to be shown, saved in X.Rda. In X.Rnw (RStudio) I read X.Rda, select one city, and produce the tables and plots. In RStudio I press \"Compile PDF\" and the city-report X.pdf is produced. I go to step 2, choose another city, and so on. This is very tedious, and looks perfect for a for-loop per city, but how can it be