[R] List dimention labels to plots of components
ligges at statistik.uni-dortmund.de
Fri Aug 20 16:27:46 CEST 2004
White, Charles E WRAIR-Wash DC wrote:
> My goal is more efficient code for something I anticipate doing a lot.
> My example code from my first message works because I insert a seemingly
> redundant recording of Dose & Treatment in the list generated in the
> "by" command. Since Dose & Treatment are already recorded in the
> dimensions of the list, I would like to pass those dimensions into the
> function executed by lapply. That may or may not be possible.
> # Append the following code to my message of 8/19
> # Dose & Treatment go to list without separate user code to insert them
> function(x) lm(Response~Sex,data=x))
> # lapply uses dimnames to select objects but does not appear to pass
> # dimnames with object
> lapply(dat.lm2,function(x) print(x)[1:13])
> Thanks for your help.
Just one example:
mapply(function(x, y) plot(x[], main = y),
outer(rownames(dat.lm2), colnames(dat.lm2), paste, sep="/"))
More information about the R-help