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 cant seem to get 
*apply to paste the column values together.

Thanks
Rory

Rory Winston
RBS Global Banking & Markets
280 Bishopsgate, London, EC2M 4RB
Office: +44 20 7085 4476



***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

______________________________________________
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