sweave

Make Sweave + RweaveHTML put all graphics in a specified folder

情到浓时终转凉″ 提交于 2019-12-05 00:18:20
问题 As a refinement of this question, does anyone know how to tell Sweave (or better the driver) to put all the graphics in a specific directory when using the RweaveHTML driver from the R2HTML package? I can't find any option for that :( 回答1: Sweave responds to the prefix.string option for figures. E.g. in one recent document I use \SweaveOpts{engine=R,eps=FALSE,echo=TRUE,prefix.string=figures/chart} which leads to files figures/chart-chunkname.pdf where I use chunkname as the identifier in the

Creating R tables with embedded graphics

送分小仙女□ 提交于 2019-12-04 16:54:19
I'd like to be able to create a table with one of the columns being graphical, others text. Ideally, I'd create an excel spreadsheet, but I'm pretty sure that none of the R to Excel packages can write PDFs into cells. I think I can hack something together using Knittr or Sweave, though I don't know how, exactly. Any advice? I've tried to reproduce your example : So I've looked into the R dataset, and used a baseball dataset, though I have the nagging doubt that for baseball players, the g-r might look really stupid... Anyway I produced two examples of the use of the get_bar_df function, and

knitr: child document in different directory

∥☆過路亽.° 提交于 2019-12-04 15:48:45
I can use the following code for child document if it is in the same directory. <<child-demo, child=knitr-input-child.Rnw, eval=TRUE>>= @ I wonder how to use child document if it is not in the same directory of master document. Thanks in advance for your help and time. This can be considered as a bug. Now I have fixed it on GitHub . Note, however, you need to setwd() to the directory of your master document before using knit() , otherwise knit() may not be able to find a child inputdir/child.Rnw . Please see if the development version works for you. Thanks! 来源: https://stackoverflow.com

Is there a way to push an R script file into a sweave document (opposite of tangle)

自作多情 提交于 2019-12-04 14:29:12
I often create specific sweave files to do analyses and produce pdf documents, however, sometimes I want to take an existing R script file and run it while producing a pdf of the commands and output together. I know there is a tangle command that pulls the R commands out of an rnw sweave file to create an R script, but I want the opposite. Edit: I have considered creating a sweave file that just sources my R script, but I'd need to edit the sweave file each time, and it wouldn't deal very well with plots and graphics. so for an example R script like this (pseudo code, might not run) head(mcars

R Sweave: NO TeX installation detected

好久不见. 提交于 2019-12-04 14:13:02
问题 I've tried searching on google to fix this, with very minimal helpful solutions. I have installed, Miktex, R and R studio. I would like to use Sweave to create PDF documents in Miktex. Everytime I open my .Rnw file, it gives a warning at the top which reads "No TeX installation detected. Please install TeX before compiling" When I look for pdflatex on my system with the command Sys.which("pdflatex") it returns "" Does anyone know how to fix this? ANYTHING at all at this point would be useful.

How to extract all code chunks from a Rnw Sweave file?

做~自己de王妃 提交于 2019-12-04 13:54:11
问题 I received a .Rnw file that gives errors when trying to build the package it belongs to. Problem is, when checking the package using the tools in RStudio, I get no useful error information whatsoever. So I need to figure out first on what code line the error occurs. In order to figure this out, I wrote this 5-minute hack to get all code chunks in a separate file. I have the feeling though I'm missing something. What is the clean way of extracting all code in an Rnw file just like you run a

header on each page of big table of xtable?

好久不见. 提交于 2019-12-04 10:02:57
How do you put on a big table of xtable the table header on each page?, So that is easier to read the table the table between pages. I use the following in Sweave: test.big<- xtable(test,label="table",caption='test') align(test.big) <- "|c|c|c|c|l|c|c|c|" print(test.big,tabular.environment='longtable',include.colnames = TRUE,floating=FALSE) Thanks for your answers The longtable (LaTeX) package specification can be found at that URL. The section of code in the examples whose output appears on pages 2 and 3 is in section 8 and I have reproduced bit of it below: \caption[]{(continued)}\\ \hline

Column names on each page with xtable in Sweave

半城伤御伤魂 提交于 2019-12-04 09:31:04
问题 I want to have column names on each page of the xtable. \documentclass{article} \usepackage{graphicx} \usepackage{longtable} \begin{document} <<>>= x <- matrix(rnorm(1000), ncol = 10) x.big <- xtable(x,label='tabbig',caption='Example of longtable spanning several pages') @ <<label = tabSEM.S, echo = FALSE, results = tex >>= print(x.big,tabular.environment='longtable',floating=FALSE) @ \end{document} Any help will be highly appreciated. Thanks 回答1: I think this is really a LaTeX question,

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

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