[R] a quick question about "rbinom"

David Winsemius dwinsemius at comcast.net
Thu Jan 5 01:26:23 CET 2012


On Jan 4, 2012, at 5:31 PM, Justin Haynes wrote:

> homework or not,
>
> ?rbinom
>
> should be plenty.

I didn't think so. I thought that the answer was:

?"["

--  
David.

>
> On Wed, Jan 4, 2012 at 1:38 PM, lynn.tsai <vernal.lyn at gmail.com>  
> wrote:
>
>> Hello, I have the following code using rbinom, but I don't  
>> understand what
>> *"+1"* means in the code. Could someone help? Thanks so much,
>>
>>> X1<-c("A","B")[rbinom(n,1,0.6)+1]
>>> X2<-c("C","D")[rbinom(n,1,0.1)+1]
>>
>> --

>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list