Re: [R] indexing question

2006-11-14 Thread Kaskelma, Heikki
Of Leeds, Mark (IED) Sent: Monday, November 13, 2006 10:06 PM To: r-help@stat.math.ethz.ch Subject: [R] indexing question I have the following set of indices, call it idx, that correspond to the indices of a vector say temp. [1] 31 36 41 61 66 71 91 96 101 121 126 131 151 156

[R] indexing question

2006-11-13 Thread Leeds, Mark \(IED\)
I have the following set of indices, call it idx, that correspond to the indices of a vector say temp. [1] 31 36 41 61 66 71 91 96 101 121 126 131 151 156 161 181 186 191 211 216 221 241 246 251 271 276 281 301 306 311 331 336 341 361 366 [36] 371 391

Re: [R] indexing question

2006-11-13 Thread Benilton Carvalho
diff(tmp[idx]) cheers, b On Nov 13, 2006, at 3:06 PM, Leeds, Mark ((IED)) wrote: I have the following set of indices, call it idx, that correspond to the indices of a vector say temp. [1] 31 36 41 61 66 71 91 96 101 121 126 131 151 156 161 181 186 191 211

Re: [R] indexing question

2006-11-13 Thread Leeds, Mark \(IED\)
, November 13, 2006 3:18 PM To: Leeds, Mark (IED) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] indexing question diff(tmp[idx]) cheers, b On Nov 13, 2006, at 3:06 PM, Leeds, Mark ((IED)) wrote: I have the following set of indices, call it idx, that correspond to the indices of a vector say

Re: [R] indexing question

2006-11-13 Thread Ray Brownrigg
On Tuesday 14 November 2006 09:28, Leeds, Mark (IED) wrote: thanks beilton but that won't work. A diff will also include 61-41 etc and I don't want to include those. I'm working on using lapply or sapply with a seq along 31, 61, etc. I'll let you know if it works. Try looking at: dim(idx) -

[R] indexing question

2004-05-19 Thread Adrian Dusa
Hi, I have a problem and a rather poor solution that I would like to improve. There a 2 datasets with different number of cases like this: Dataset ‘poploc’Dataset ‘siruta’ Case no. SIRUTA TYPECase no. SIRUTA TYPE 1

RE: [R] indexing question

2004-05-19 Thread Benjamin . STABLER
take a look at match or maybe merge -Original Message- From: Adrian Dusa [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 8:44 AM To: [EMAIL PROTECTED] Subject: [R] indexing question Hi, I have a problem and a rather poor solution that I would like to improve. There a 2

Re: [R] indexing question

2004-05-19 Thread Sundar Dorai-Raj
Adrian Dusa wrote: Hi, I have a problem and a rather poor solution that I would like to improve. There a 2 datasets with different number of cases like this: Dataset poplocDataset siruta Case no. SIRUTA TYPECase no. SIRUTA TYPE 1

RE: [R] indexing question

2004-05-19 Thread Adrian Dusa
Many many thanks. merge is the function I needed. Regards, Adrian -Original Message- From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 6:54 PM To: Adrian Dusa Cc: [EMAIL PROTECTED] Subject: Re: [R] indexing question Adrian Dusa wrote: Hi, I have

[R] Indexing Question

2003-10-09 Thread Nathan Cooper
I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample function to take two samples from b[[1]] to b[[1000]] each separately. I thought something like

Re: [R] Indexing Question

2003-10-09 Thread Peter Dalgaard BSA
Nathan Cooper [EMAIL PROTECTED] writes: I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample function to take two samples from b[[1]] to b[[1000]] each

Re: [R] Indexing Question

2003-10-09 Thread Roger D. Peng
I think what you want is lapply(b, function(x) sample(na.omit(x), 2, replace = TRUE)) -roger Nathan Cooper wrote: I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample