Message-ID: <F7460A85-1415-4E7E-81A5-5CB8D0F15447@jhsph.edu>
Date: 2008-03-01T16:01:13Z
From: Benilton Carvalho
Subject: A question on getting all possible combinations
In-Reply-To: <638198.99275.qm@web58110.mail.re3.yahoo.com>
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 :
>
> uuuuuu
> uuuuud
> uuuudu
> .........
> ........
> dddddd
>
> This type of combination generally required for Option Pricing in
> financial/derivative market. Here generally 'u' means: up-move and
> 'd' means down move of price like Stock price etc.
>
> Is there any easy way in R for doing that?
>
> Regards,
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.