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
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
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
, 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
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) -
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
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
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
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
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
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
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
12 matches
Mail list logo