Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Ben Bolker
rbs.com> writes: > > Sorry, I spoke too soon... > > interaction() only works for sequences of equal length. Anyone know a method that works with > unequal-length vectors? > Something like c(outer(vec1,vec2,paste,sep="")) ? (totally untested) Ben Bolker ___

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Henrique Dallazuanna
) > > > > Rory Winston > RBS Global Banking & Markets > Office: +44 20 7085 4476 > > -Original Message- > From: WINSTON, Rory, GBM > Sent: 05 December 2008 14:30 > To: WINSTON, Rory, GBM; [EMAIL PROTECTED] > Cc: r-help@r-project.org > Subje

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
WINSTON, Rory, GBM; [EMAIL PROTECTED] Cc: r-help@r-project.org Subject: RE: [R] Cartesian Product Of Character Vectors Sorry, I spoke too soon... interaction() only works for sequences of equal length. Anyone know a method that works with unequal-length vectors? Rory Winston RBS Global Ban

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
] On Behalf Of WINSTON, Rory, GBM Sent: 05 December 2008 14:20 To: [EMAIL PROTECTED] Cc: r-help@r-project.org Subject: Re: [R] Cartesian Product Of Character Vectors Hi David Perfect - if I specify sep="", it gives me exactly what I need. Cheers Rory Winston RBS Global Banking & M

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
M Cc: r-help@r-project.org Subject: Re: [R] Cartesian Product Of Character Vectors Does this satisfy? levels(interaction(x,y)) [1] "aaa.1" "bbb.1" "ccc.1" "aaa.2" "bbb.2" "ccc.2" "aaa.3" "bbb.3" "ccc.3" -- David W

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread David Winsemius
Does this satisfy? levels(interaction(x,y)) [1] "aaa.1" "bbb.1" "ccc.1" "aaa.2" "bbb.2" "ccc.2" "aaa.3" "bbb.3" "ccc.3" -- David Winsemius On Dec 5, 2008, at 8:12 AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Hi all (I'm sure this question has been asked before, but I cant find i

[R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
Hi all (I'm sure this question has been asked before, but I cant find it). If I have two character vectors: > x <- c("aaa","bbb","ccc") > y <- c("1","2","3") How can I get the cartesian product of the string values? > expand.grid(x,y) Gives me a data frame with separate columns...however, I c