[R] a quick question about "rbinom"

Bert Gunter gunter.berton at gene.com
Wed Jan 4 23:26:02 CET 2012


Homework?

If not, context?

-- Bert

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]
>
> --
> View this message in context: http://r.789695.n4.nabble.com/a-quick-question-about-rbinom-tp4262977p4262977.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list