[R] Sweave: Variables in code chunk headers
I would like to be able to do something like this: <>= ... @ with mywidth set in a previous code chunk. Is there a way to do this in Sweave? (Sorry for two questions in a row, I have been saving these up.) -- Michael __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave: Variables in code chunk headers
Michael Hoffman sneakemail.com> writes: > > I would like to be able to do something like this: > ><>= >... >@ > > with mywidth set in a previous code chunk. Is there a way to do this in > Sweave? > Not in the <<>>, but you could set a hook for fig: >From Sweave docs: If option "SweaveHooks" is defined as list(fig = foo), and foo is a function, then it would be executed before the code in each figure chunk. This is especially useful to set defaults for the graphical parameters in a series of figure chunks. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave: Variables in code chunk headers
Dieter Menne wrote: > Michael Hoffman sneakemail.com> writes: > >> I would like to be able to do something like this: >> >><>= >>... >>@ >> >> with mywidth set in a previous code chunk. Is there a way to do this in >> Sweave? >> > > Not in the <<>>, but you could set a hook for fig: > > >>From Sweave docs: > > If option "SweaveHooks" is defined as list(fig = foo), and foo is a function, > then it would be executed before the code in each figure chunk. This is > especially useful to set defaults for the graphical parameters in a series of > figure chunks. Thanks. I guess what I really want to do is switch between one of two settings. Only one value can be in the defaults, and I would like some way of setting the other value. This might not be easily possible, but I thought I would ask. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.