sweave

Sweave xtable: how to position tables between text?

I have a number of tables with text around them describing them. Something like this: This table shows blah blah... <<echo=FALSE, results=tex>>= print( xtable(x, caption = "blah", label = "tab:four", table.placement = "tbp", caption.placement = "top") , size = "small", table.placement="ht") @ This table shows blah blah....

How to include a Percent Symbol in an xtable caption using Sweave in R

I'm trying to use Sweave to generate a statistical report, and am trying to put a caption on an xtable, however if I include the percent symbol this breaks things. Some example code <<label=Analyte2_Results, results=tex, echo=FALSE>>= print(xtable(result[[2]], caption=paste(levels(vardata$Analyte)[1], " ...

practically getting started with Sweave

Dear all, my question(s) might be less general than the title suggests. I am running R on Mac OS X with a MySQL database to store the data. I have been working with the Komodo / Sciviews-R for some time. Recently I had the need for auto-generated reports and looked into Sweave. I guess StatET / Eclipse appears to be the "standard" solu...

sweave and ggplot2: no pdfs generated at all

Dear all, i am trying create a sweave report that contains some graphics done with ggplot2. Though I am looking for some environment for the long run – I just use a simple .Rnw file here that only contains the code and the plot \documentclass[a4paper]{article} \SweaveOpts{echo=FALSE} \usepackage{a4wide} \begin{document} \begi...

invalid multibyte character crashes when script is loaded from source (umlauts / special characters)

EDIT: Thx to suggestions from the mailing list I realized that the problem I got has nothing to do with Sweave or Latex. It´s some Mac OS X related issue. Whenever I run my script by selecting all and sending it to R it works. When I use source("myplainRcode.R") i get the error message stated below finally I got sweave working ...

Multiple Tables Sweave/Latex

Hi All, I am very new to LaTeX and Sweave but am excited that it may make my life much simpler when combined with R. What I am looking to do: Create multiple crosstabs, most likely in a loop. As a result, the number of tables will not be determined ahead of time and I am hoping to have a page break in between each. Lastly, for the ...

How to use ggplot2 graphics inside minipage with Sweave?

Here's my code that's supposed to display to graphics next to each other, but fails to do so. In fact the sweave part is not interpreted. \begin{figure}[h] \begin{center} \begin{minipage}[t]{.485\linewidth} % <<fig=true,echo=false>>= print(graph2) @ \newline{\color{red}{\caption{\label{idx}Graph one}}} \end{minipage} \hspace...

How to use Sweave (R) code inside a fancyhdr ?

Dear all, I am generating an automatically generated periodical report with Sweave. In order to create a nice header I use the fancyhdr package which works really well so far. Now, since my report is periodical I want to change the header dynamically without passing an argument to the function. That's why I wrote a little R function th...

Sweave not printing localized characters

I'm trying to incorporate some plots from R in my LaTeX document through Sweave. \SweaveOpts{eps = FALSE, pdf = TRUE, echo = FALSE, prefix = TRUE, prefix.string = data} <<label = abundanca:barplot, fig = TRUE, include = FALSE, results = hide>>= barplot(abund, xlab="Vzorčne postaje", ylab="Abundanca", main="", col="slategrey", names.arg...

Counts & Percentages in xTable, Sweave, R, cross tabulations

Edit: Building off of aL3xa's answer below, I've modified his syntax below. Not perfect, but getting closer. I still haven't found a way to make xtable accept \multicolumn{} arguments for columns or rows. It also appears that Hmisc handles some of these type of tasks behind the scenes, but it looks like a bit of an undertaking to underst...

help me Sweave a multi-file project

Dear SOers, I am writing my thesis in LaTeX and because things got a bit long for my taste, I had split it into several files. Let's call them thesis.tex, intro.tex, mat_n_met.tex, rslts.tex and discsn.tex. I have linked intro.tex, mat_n_met.tex, rslts.tex and discsn.tex through thesis.tex with \include{intro} (and so on...). I have als...

Set directory of files created by a shell script?

Dear all, EDIT: had to retag this, because, it's rather a Sweave / R question since the problem of this script is the output directory of the Sweave Code. Is there a corresponding option for R CMD Sweave ? I have a shell script that creates a .tex file from a .Rnw file. This file needs to be processed further, but is not found by the s...

How can I change the output directory of R CMD Sweave?

The question title says it all. Using R CMD Sweave my .tex file is always generated in my HOME directory. Is it possible to change this? I mean i could mv it with a shell script, but I guess there`s some better trick to do it :) @Dirk: I used the script that I posted here and pdflatex does not find the file because it's always written ...

Windows batch R Sweave error loading packages

I am having trouble finding clear documentation on how to set up a batch file for a Sweave document on Windows XP. I am using the batch files that are found here I have created a batch file names run.bat which contains the following: Sweave myFile.Rnw The first thing I do in my Sweave file after setting the wd is read in a dataset ...

Print long strings of text LaTeX / Sweave

At the end of a survey I've conducted, we give respondents an open ended box to tell us anything we didn't cover in the survey.These comments will often span several pages. I am familiar with the longtable package for LaTeX and here is the solution I have mocked up: <<results = tex>>= cat("\\begin{longtable}{p{14cm}}\n") cat("\\hline\n"...

R Sweave user defined function

Dear all, I´m writing up a small function giving a combined conditional density and empirical cumulative distribution plot. cdpl<-function(df,dep,indep){ attach(df) cdplot(dep~indep,xlab=deparse(substitute(indep)),ylab=deparse(substitute(dep))) g<-indep ec<-ecdf(indep) lines(knots(ec),as.numeric(names(table(ec(g)))...

Theming with Sweave or other LaTeX like PDF Generators that are R friendly.

Is there a way to generate a theme for sweave documents? I have a number of reports that I generate monthly, where I use R to generate the text, tables and images. But now I'm stuck in the rut of copying and pasting this information into MS Publisher placing the text in a themed document that we had a graphic designer make for us. What...

how can I suppress output from Sweave that is not suppressed by echo=FALSE?

I am getting extraneous output in my .tex file that I can not suppress with <> or sink(). Notably, the unwanted lines are not enclosed by ..{Schunk} or similar. This occurs for me when I use either DEoptim or rjags, although this is likely not limited to these functions. example .Rnw file: \documentclass[a4paper, 12]{article} begin{do...