[R] A question on getting all possible combinations

2008-03-01 Thread Megh Dal
Hi all, Suppose I have to letters 'u' and 'd'. Now I want to find all combinations like that : uu ud du . dd This type of combination generally required for Option Pricing in financial/derivative market. Here generally 'u' means: up-move and 'd' means down mo

Re: [R] A question on getting all possible combinations

2008-03-01 Thread Benilton Carvalho
target = c("u", "d") apply(expand.grid(rep(list(target), 6)), 1, paste, sep="", collapse="") b On Mar 1, 2008, at 9:13 AM, Megh Dal wrote: Hi all, Suppose I have to letters 'u' and 'd'. Now I want to find all combinations like that : uu ud du . dd This t

Re: [R] A question on getting all possible combinations

2008-03-01 Thread Wolfgang Huber
library("R.utils") intToBin(0:63) Best wishes Wolfgang -- Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber Benilton Carvalho scripsit: > target = c("u", "d") > apply(expand.grid(rep(list(target), 6)), 1, paste,