?sample
sample(c(1,2),10,replace=TRUE)

P.

raymond chiruka napsal(a):
>      l want to create a  column of 1 and 2 randomly what command should l use 
>   eg
>   treatment          strata
>       
>   1                      1
>   2                      0
>   1                      1
>   2                      1
>   2                      0          
>   2                      1
>   2                      0
>   1                      0
>   these should be created randomly
>   
>   secondly if l have something like 
>   for (i in 1:n ) df =c(1,rexp(1,.001),rexp(1,.002)) can l add an if 
> statement in  side the c maybe to compare the 2 exponential  numbers to 
> create  another  variable
>     
>        
> ---------------------------------
> 
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] 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.
> 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

______________________________________________
[email protected] 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.

Reply via email to