Hi,
I am using this subset statement and it works
outside a function.
LIS[[i]]<- lapply(LI, subset, select=cov[[i]]) 
However, wrapped inside a function this statement
produces the same values for every LIS[[1]] which
is only the first subset of LI.
Does anyone know why is not working correctly inside
a function?

ff = factor(covariate)
nLev <- nlevels(ff)
cov <- vector(mode="list",length=nLev)
for (gp in 1:nLev) {
cov[[gp]] <- covariate == levels(ff)[gp]  }

LIS <- vector(mode="list",length=nLev)
#if (SINGLE == T ) LIS[[1]] <- LI else {}
for (i in 1:nLev) 
LIS[[i]]<- lapply(LI, subset, select=cov[[i]]) 


Lana Schaffer
Biostatistics/Informatics
The Scripps Research Institute
DNA Array Core Facility
La Jolla, CA 92037
(858) 784-2263
(858) 784-2994
[EMAIL PROTECTED] 

______________________________________________
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.

Reply via email to