[R] Reconstruct a dataset

Lisa lisajca at gmail.com
Wed Dec 16 04:18:55 CET 2009


Thanks a lot for your help. As I mentioned in my second subscription, my
problem is not generating the random number, but rewriting the original
dataset based on the sets of random number, or indices. 

Lisa



Lisa wrote:
> 
> Dear all,
> 
> I have a dataset that looks like this:
> 
> inividual   var1  var2   …
> 1              1     1   …
> 2              1     2   …  
> 3              2     1   …  
> 4              2     2   …  
> …              …     …   …
> 
> I will random sample 2 individuals from this dataset based on a set of
> random numbers, e.g., 
> 
> rn1 <- c(0, 0, 1, 1),  rn2 <- c(0, 0, 2, 0), rn3 <- c(1, 0, 0, 1), rn4 <-
> c(0, 1, 1, 0),…
> 
> After reconstructed the samples, I have a dataset that looks like this:
> 
> id  var1.1  var1.2  var2.1  var2.2  …
> 1        2       2       1       2  …
> 2        2       2       1       1  … 
> 3        1       2       1       2  … 
> 4        1       2       2       1  … 
> …        …       …       …       …  …
> 
> Please ignore the bold and italic fond styles, I just want to make my
> problem clear.
> 
> Can anyone please help how to get this done? Your help would be greatly
> appreciated. 
> 
> Lisa 
> 
> 
> 

-- 
View this message in context: http://n4.nabble.com/Reconstruct-a-dataset-tp964699p964885.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list