Hello all,
I need some help with a nice R-idiomatic and efficient solution to a
small problem.
Essentially, I am trying to eliminate randomly half of the entries in
a vector that contains index values into some other vectors.
More details:
I am working with two strings/vectors of 0s and 1s.
Here is what I got for script through your third question:
set.seed(1)
x1 = rbinom(200,1,.5)
x2 = rbinom(200,1,.5)
differ = x1 != x2
differ.indexes = (1:length(x1))[differ == TRUE]
#you were unclear if you want to round up or round down on odd index of
differ.indexes
n = floor(
(sorry if this is a duplicate-problems with posting at my end)
Hello all,
I need some help with a nice R-idiomatic and efficient solution to a
small problem.
Essentially, I am trying to eliminate randomly half of the entries in
a vector that contains index values into some other vectors.
This is my first help post, hope it works!
Just check out the sample function
At the command line type:
?sample
I think it will be pretty clear from the documentation.
On Tue, Feb 17, 2009 at 9:13 PM, Esmail Bonakdarian esmail...@gmail.comwrote:
(sorry if this is a duplicate-problems with
Gene Leynes wrote:
This is my first help post, hope it works!
Just check out the sample function
At the command line type:
?sample
I think it will be pretty clear from the documentation.
Yes, most excellent suggestion and quite helpful!
Thanks,
Esmail
5 matches
Mail list logo