[R] How to call patchDVI::SweavePDF on an .Rnw which is not the master file?

2012-08-16 Thread Marius Hofert
Dear expeRts, I have a master file master.tex containing the preamble and which inputs (via \input{chapter01}, \input{chapter02}, ...) chapters. The chapters are .Rnw files. My goal is to use patchDVI::SweavePDF to compile the chapters (say, chapter.Rnw) individually (each chapter starts with sour

Re: [R] patchDVI: how to pass encoding of the .Rnw file?

2012-08-24 Thread Marius Hofert
Dear Duncan, many thanks for helping. It works fine. Cheers, Marius Duncan Murdoch writes: > On 12-08-19 3:47 PM, Marius Hofert wrote: >> Dear Duncan, >> >> I recently asked a question concerning patchDVI on r-help, see >> >> , >> | https://st

[R] How to insert vertical space between lines of tables created with the R package 'tables'?

2012-09-08 Thread Marius Hofert
I have the data frame... df <- cbind(expand.grid(d=as.factor(c(2,5)), n=c(100, 200), beta=as.factor(c(0.2, 0.8)), group=LETTERS[1:2]), value=runif(16)) ... which I would like to display in a table like ... require(tables) tabular(d * beta ~ group * mean * Heading() * value, data=df) Now I would

Re: [R] How to insert vertical space between lines of tables created with the R package 'tables'?

2012-09-08 Thread Marius Hofert
Duncan Murdoch writes: > > The + means concatenation, so that spec says to put the RowFactor above the > d*beta rows. Not sure why that causes an error, but it's likely because > you've > got the wrong number of items. > > This should work, but it doesn't give you the extra spacing properly.

[R] acast: how to obtain names?

2011-11-18 Thread Marius Hofert
Hi, After applying acast() I typically have to adjust the names of the array by hand. Is there any way to tell acast to do this automatically? Cheers, Marius require(reshape2) (df <- data.frame(a=c("a1","a2"), b=c("b1","b2"), c=c("c1","c2"))) a.df <- acast(df, a~b, value_var="c") names(dimname

[R] How to color a region in a contour plot with the contour being the boundary?

2011-12-31 Thread Marius Hofert
Dear expeRts, I would like to color a certain region in a levelplot. The region for z <= 0.02 should have a dark gray color. Below is a minimal example. It almost does what I want, but The region between z=0.02 and z=1 is also colored in dark gray (instead of just the region for z <= 0.02). How

Re: [R] How to color a region in a contour plot with the contour being the boundary?

2012-01-03 Thread Marius Hofert
<- pmax(f(dat$x) + f(dat$y) - 10, 0) > > levelplot(z ~ x * y, dat, > at=c(-1, 0.02, 1, 5, 10, 20, 50, 500, 900), > labels=TRUE, contour=TRUE, colorkey=FALSE, > col.regions=gray(c(0.2, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1))) > > Jean >

[R] How to colorize the panel backgrounds of pairs()?

2012-03-01 Thread Marius Hofert
Dear expeRts, I would like to colorize the backgrounds of a pairs plot according to the respective panel number. Here is what I tried (without success): count <- 0 mypanel <- function(x, y, ...){ count <<- count+1 bg. <- if(count %in% c(1,4,9,12)) "#FDFF65" else NA points(x, y, cex=0

Re: [R] How to colorize the panel backgrounds of pairs()?

2012-03-02 Thread Marius Hofert
else "transparent" ll <- par("usr") rect(ll[1], ll[3], ll[2], ll[4], col=bg) points(x, y, cex=0.5) } mydiag.panel <- function(x, ...){ ll <- par("usr") rect(ll[1], ll[3], ll[2], ll[4], col="#FDFF65") } U <- matrix(runif(4*5

Re: [R] How to colorize the panel backgrounds of pairs()?

2012-03-02 Thread Marius Hofert
Okay, one simply has to use label.pos=0.5 in pairs() to get the correct behavior. On 2012-03-02, at 09:10 , Marius Hofert wrote: > Dear Ilai, > > I tried to also adjust the diagonal panels. However, the variable names are > not > positioned correctly anymore. Do you

[R] How to access the panel rows/columns in pairs()?

2012-01-21 Thread Marius Hofert
Hi, I would like to colorize certain panels in the pairs plot below with certain colors. How can access the panel row and column in a pairs plot to achieve this? Cheers, Marius ## generate data U <- matrix(runif(4000), ncol=4) ## define panel function for colorizing the panels mypanel <- fun

[R] Fwd: How to access the panel rows/columns in pairs()?

2012-01-21 Thread Marius Hofert
okay, I found something. Not very elegant, but it does the job: ## generate data U <- matrix(runif(4000), ncol=4) ## define panel function for colorizing the panels cols <- c("blue", "black", "black", "blue", "black", "black", "black", "black", "green", "black", "bla

[R] Hmisc's latex: na.blank and grouping not working as expected

2012-05-02 Thread Marius Hofert
Dear expeRts, Why does na.blank=TRUE not replace the NA's in the following LaTeX table? x <- matrix(1:72, ncol=4, nrow=8) colnames(x) <- c("gr1.sgr1", "gr1.sgr2", "gr2.sgr1", "gr2.sgr2") rn <- apply(expand.grid(beta=c(0.25, 0.75), n=c(100, 500), d=c(10, 100))[, 3:1], 2, rmNames) x <- cbind(rn, x

Re: [R] Hmisc's latex: na.blank and grouping not working as expected

2012-05-02 Thread Marius Hofert
ted due to "cgroup", but I don't know how to avoid this. On 2012-05-02, at 09:26 , Marius Hofert wrote: > Dear expeRts, > > Why does na.blank=TRUE not replace the NA's in the following LaTeX table? > > x <- matrix(1:72, ncol=4, nrow=8) > colnames(x) <-

<    1   2   3