[R] 3 questions regarding matrix copy/shuffle/compares

Esmail esmail.js at gmail.com
Sun Apr 26 15:43:40 CEST 2009


David Winsemius wrote:
> 
> Yes. As I said before "I am going to refrain from posting speculation 
> until you provide valid R code
> that will create an object that can be the subject of operations."


The code I have provided works, here is a run that may prove helpful:

POP_SIZE = 6
LEN = 8

pop=create_pop_2(POP_SIZE, LEN)

print(pop)
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
  [1,]    0    1    0    1    1    0    0    1
  [2,]    0    0    0    0    0    0    0    0
  [3,]    1    1    0    0    1    0    0    0
  [4,]    0    0    0    0    0    0    0    1
  [5,]    0    0    1    1    0    0    1    0
  [6,]    1    0    0    0    0    0    1    0
  [7,]    0    0    0    0    0    0    0    0
  [8,]    0    0    0    0    0    0    0    0
  [9,]    0    0    0    0    0    0    0    0
[10,]    0    0    0    0    0    0    0    0
[11,]    0    0    0    0    0    0    0    0
[12,]    0    0    0    0    0    0    0    0

I want to (1) create a deep copy of pop, (2) be able to shuffle
the rows only, and (3) be able to compare two copies of these objects
for equality and have it return True if only the rows have been shuffled.



More information about the R-help mailing list