Re: [R] Fw: random sampling steps in R with replacement

2011-03-14 Thread taby gathoni
Andrija, Thank you very much this worked very well and i was also able to calculate the Mann-Whitney test and the confidence intervals using the wilcox test. --- On Thu, 3/10/11, andrija djurovic wrote: From: andrija djurovic Subject: Re: [R] Fw: random sampling steps in R with

Re: [R] Fw: random sampling steps in R with replacement

2011-03-10 Thread Dennis Murphy
Hi: To get the samples, here's one approach: df <- data.frame(gender = rep(c('F', 'M'), c(165, 42)), y = rpois(207, 20)) # Sampling function to take 20 F and 20 M with replacement # The sample function operates on the rows of df to get idx and then takes # the y's corresponding to those rows sfun

Re: [R] Fw: random sampling steps in R with replacement

2011-03-10 Thread andrija djurovic
Hi Taby, this is not best solution for sure but it will give you, maybe, some ideas :) I am also looking forward to see other solutions. data<-data.frame(id=1:(165+42),x=rep(c("male","female"),c(42,165))) f<-function(x) { str.sample<-list() for (i in 1:length(levels(x$x))) { str.sample[[i]]<-x[x$

[R] Fw: random sampling steps in R with replacement

2011-03-10 Thread taby gathoni
Please note is with replacement From: taby gathoni To: R help Sent: Thursday, March 10, 2011 11:53 AM Subject: [R] random sampling steps in R Dear all, Could someone assist me in random sampling steps/code in R? I have a main sample of 42 males and 165 females and I want to come up with a