Jim,
It is not completely clear how you want to handle the items in Array2,
but perhaps something like the following does what you needs (or at
least points you in the right direction):
paste(
rep(Array1, each=2),
rep(Array2[1], times=8),
rep(Array2[2:3], times=4),
sep='.')
Regards,
Jan
Quoting "Maas James Dr (MED)" <j.m...@uea.ac.uk>:
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.
______________________________________________
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.