[R] creating columns

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Thu May 17 21:00:54 CEST 2007


See my response to your thread " controling the size of vectors in a 
matrix". Please do not create multiple threads on the same day asking 
basically the same question, especially if you cannot substantially 
improve the clarity and quality of the post.

Multiple threads asking the same question badly within the span of few 
hours leads to people missing out on other people's response and thereby 
essentially wasting their time.



raymond chiruka wrote:
> l would like to create the following matrice
>   
>   treatmentgrp            strata
>                    1    1          1    1          1    1          1    2          1    2          1    2          2    1          2    1          2    1          2    2          2    2          2    2       l should be able to choose the size of the treatment grps and stratas the method l used intially creates the matrice randomly
>   
> n=20
>   
> m <- cbind( treatmentgrp  = sample( 1:2,n, replace=T ),
>   
>               strata        = sample( 1:2, n, replace=T ),
>   
>               survivalTime  = rexp( n, rate=0.07 ),
>   
>               somethingElse = rexp( n, rate=0.02 ) 
>        
>     thanks
>   
>   
>        
> ---------------------------------
> Give spam the boot. Take control with tough spam protection
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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