[R] Sweave data-figure coupling
Sebastian P. Luque
spluque at gmail.com
Mon Jan 5 21:24:42 CET 2009
On Mon, 05 Jan 2009 15:14:37 -0500,
Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
[...]
> You missed an @ after this chunk. If this is true in the original,
> I'm surprised Sweave didn't report an error, but it probably ate up
> the second chunk as part of the first.
AFAIK there's no need to separate every chunk by "@", if one doesn't
need to switch to documentation. At any rate, adding the extra "@"
doesn't change anything in this case.
>> <<binom-sim-fig, fig=TRUE, include=FALSE, height=3, echo=FALSE>>=
>> layout(matrix(1:2, ncol=2)); par(mar=c(5, 4, 2, 1), cex=0.75)
>> matplot(thetas, cbind(prior, lik, post), type="l", lty=c(2, 1, 1),
>> xlab="theta", ylab="probability density") lik <- dbinom(60, 100,
>> thetas)
> It's a bad idea to generate random values in a fig=TRUE chunk, because
> the code gets evaluated multiple times, but I don't think this would
> cause your error.
Yes, in my real file, I have set.seed() inside such chunks to avoid
problems with that.
Thanks,
--
Seb
More information about the R-help
mailing list