[R] Sampling

markleeds at verizon.net markleeds at verizon.net
Tue Feb 5 20:19:24 CET 2008


>From: Judith Flores <juryef at yahoo.com>
>Date: 2008/02/05 Tue PM 12:52:06 CST
>To: RHelp <r-help at stat.math.ethz.ch>
>Subject: [R] Sampling

you just can put 24 in there and
then use replace=FALSE

sample(rep(letters[1:2],c(12,12),24,replace=FALSE))


>Hi there,
>
>   I want to generate different samples using the
>followindg code:
>
>
>g<-sample(LETTERS[1:2], 24, replace=T)
>
>   How can I specify that I need 12 "A"s and 12 "B"s?
>
>Thank you,
>
>Judith
>
>
>      ____________________________________________________________________________________
>Be a better friend, newshound, and
>
>______________________________________________
>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.



More information about the R-help mailing list