[R] List dimention labels to plots of components

White, Charles E WRAIR-Wash DC charles.edwin.white at us.army.mil
Fri Aug 20 15:52:14 CEST 2004

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. 


More information about the R-help mailing list