Try this: with(expand.grid(Array1, combn(Array2, 2, paste, collapse = '.')[-3]), paste(Var1, Var2, sep = '.'))
On Tue, Aug 31, 2010 at 10:16 AM, Maas James Dr (MED) <j.m...@uea.ac.uk>wrote: > If possible I would like to combine two different character arrays in > combinations > > Array1 <- c("height","weight","age","sex") > > Array2 <- c("trt0","trt1","trt2") > > I would like to combine these two character vectors to end up with such ... > > Array3 > > "height.trt0.trt1" > "height.trt0.trt2" > "weight.trt0.trt1" > "weight.trt0.trt2" > "age.trt0.trt1" > "age.trt0.trt2" > "sex.trt0.trt1" > "sex.trt0.trt2" > > I'm trying combinations of the "combinations" and "paste" functions, but no > luck yet! > Any suggestions about most efficient approach most welcome. > Thanks > > Jim > > =============================== > Dr. Jim Maas > University of East Anglia > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.