[R] Pascal's Triangle
Jason J. Pitt
pittjj at uchicago.edu
Wed Dec 28 10:53:16 CET 2011
Oh and also, if it makes sense, you can use n choose k (
choose() ) to calculate each element of the triangle if you
don't want to deal with indicies, addition, etc.
---- Original message ----
>Date: Wed, 28 Dec 2011 03:42:11 -0600 (CST)
>From: r-help-bounces at r-project.org (on behalf of "Jason J.
Pitt" <pittjj at uchicago.edu>)
>Subject: Re: [R] Pascal's Triangle
>To: "Matilda E. Gogos" <matildaelizabethv at gmail.com>, r-
help at r-project.org
>My ignorance of the mathematical properties of Pascal's
>Triangle might make me overlook a much easier way to do this,
>but my first brute force thought was to use a list to store
>each level of the triangle (i.e. a list of vectors). You can
>then use the values of the previous level to calculate the
>values of the next level.
>Then it should just be a matter of formatting using spaces or
>tabs and printing each level (vector) in the list. There may
>be some nuances to this depending how you want it to look,
>nothing a little trial and error and Googling can't solve.
>---- Original message ----
>>Date: Tue, 27 Dec 2011 23:14:27 -0500
>>From: r-help-bounces at r-project.org (on behalf of "Matilda E.
>Gogos" <matildaelizabethv at gmail.com>)
>>Subject: [R] Pascal's Triangle
>>To: r-help at r-project.org
>>Looking to generate Pascal's triangle in R. How do I get
>>matildaelizabethv at gmail.com
>> [[alternative HTML version deleted]]
>>R-help at r-project.org mailing list
>>PLEASE do read the posting guide http://www.R-
>>and provide commented, minimal, self-contained, reproducible
>R-help at r-project.org mailing list
>PLEASE do read the posting guide http://www.R-
>and provide commented, minimal, self-contained, reproducible
More information about the R-help