[R] Sample Function

John Kane jrkrideau at yahoo.ca
Thu Jul 16 21:23:10 CEST 2009


What is dataset?

What is this supposed to be doing?
newsample<-dataset[sample(m,replace=T),] 


--- On Thu, 7/16/09, MarcioRibeiro <mestat at pop.com.br> wrote:

> From: MarcioRibeiro <mestat at pop.com.br>
> Subject: [R]  Sample Function
> To: r-help at r-project.org
> Received: Thursday, July 16, 2009, 11:55 AM
> 
> Hi listers,
> Suppose I have a dataset with n=10 observations and I want
> to sample with
> replacement.
> My new sample is of size m=9.
> So, I am using the following code...
> newsample<-dataset[sample(m,replace=T),]
> The problem is that generates the new sample and the last
> observation of my
> data set is never included.
> I can sample the identification like this code...
> newsample<-sample(1:n,m,replace=TRUE)
> But, after this code I am obtaining a statistic and I have
> only the
> identification of the data observed.
> Is there a way that I can sample the data observed to
> calculate a statistic
> of it.
> Thanks in advance,
> Marcio
> -- 
> View this message in context: http://www.nabble.com/Sample-Function-tp24519230p24519230.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
> 


      __________________________________________________________________
[[elided Yahoo spam]]




More information about the R-help mailing list