[R] How to replace a pair of observations in a matrix?

2009-03-12 Thread WXE83
Dear all, I did this replacement below and its work for the first case but not in the second case! Please tell me what's wrong with the second case. Case 1: m [,1] [,2] [1,]14 [2,]25 [3,]36 l [,1] [,2] [1,]9 10 matric1-replace(m,m[3,],l)

[R] How to select randomly from a matrix?

2009-03-09 Thread WXE83
Dear all, I got one problem here and hoping someone can help me on this. Say I have a 50 by 2 matrix and I don't know how to randomly select: 1. a pair of observations from the last 10th of the 50 observation from the matrix. 2. how to select randomly an observation from the first 5

Re: [R] How to select randomly from a matrix?

2009-03-09 Thread WXE83
Thanks, it works.. Regards, Siti Domenico Vistocco wrote: WXE83 wrote: Dear all, I got one problem here and hoping someone can help me on this. Say I have a 50 by 2 matrix and I don't know how to randomly select: data - matrix(1:25, 50, 2) 1. a pair of observations from the last