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

From: Benilton Carvalho <bcarvalh_at_jhsph.edu>
Date: Sat, 01 Mar 2008 11:01:13 -0500

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.



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. Received on Sat 01 Mar 2008 - 16:04:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 01 Mar 2008 - 22:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive