Andreas,
Thanks alot. I combined below and other suggestions given on r-help and it
worked.
--- On Fri, 4/8/11, Andreas Borg wrote:
From: Andreas Borg
Subject: Re: [R] random sampling with levels and with replacement
To: tab...@yahoo.com
Cc: "R help"
Date: Friday, Apr
Thanks Daniel,
Its a long way but it will work.
--- On Fri, 4/8/11, Daniel Malter wrote:
From: Daniel Malter
Subject: Re: [R] random sampling with levels and with replacement
To: r-help@r-project.org
Date: Friday, April 8, 2011, 10:08 AM
If you want perfect equality, split the data
Hi,
I am not perfectly sure what you want to do, but here is what I would do
to maintain good/bad ratio in the sample (as Daniel posted, split the
data and sample from the groups):
df <- data.frame(V1 = 1:400, V2 = c(rep("good",360), rep("bad",40)))
isGood <- which(df$V2=="good")
isBad <- whi
If you want perfect equality, split the data in good and bad and sample from
the two samples individually.
On average, however, random sampling from the entire data will reproduce the
proportion of good and bad in the data.
hth,
Daniel
--
View this message in context:
http://r.789695.n4.nabbl
Dear all,
i have a dataset of about 400 records , with a variable that has two levels 40
bad and 360 good among other variables,how do i come up with10 random samples
that have the composition of as the main sample but maintaining the 40 bad 360
good with replacement, i recently discovered th
5 matches
Mail list logo