Thanks you very much. Yes, this is exactly what I want. Best wishes, Jan Sabee
On 4/19/05, Liaw, Andy <[EMAIL PROTECTED]> wrote: > Is something like this what you're looking for? > > fixSome <- function(..., fixed) { > fList <- list(...) > for (i in fixed) fList[[i]] <- fList[[i]][1] > do.call("expand.grid", fList) > } > > > age <- c("young","mid","old") > > married <- c("no","yes") > > income <- c("low","high","medium") > > gender <- c("female","male") > > > > age.income.dat <- fixSome(age, married, income, gender, fixed=c(2, 4)) > > age.income.dat > Var1 Var2 Var3 Var4 > 1 young no low female > 2 mid no low female > 3 old no low female > 4 young no high female > 5 mid no high female > 6 old no high female > 7 young no medium female > 8 mid no medium female > 9 old no medium female > > Andy ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html