[R] Bootstrapping in R

David Carlson dcarlson at tamu.edu
Thu Apr 25 15:28:18 CEST 2013


First you should read some introductory manuals on R. There are many to
choose from at

http://cran.r-project.org/other-docs.html

For example, your first question is very simple:

z <- data.frame(a, b, c)

To draw a single random sample (with replacement) from z:

z1 <- z[sample(1:nrow(z), nrow(z), replace=TRUE),]

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Michael Weylandt
Sent: Thursday, April 25, 2013 4:36 AM
To: Preetam Pal
Cc: r-help at r-project.org
Subject: Re: [R] Bootstrapping in R



On Apr 25, 2013, at 7:02, Preetam Pal <lordpreetam at gmail.com> wrote:

> Hi all,
> 
> 1>i have 3 vectors a,b and c, each of length 25....... i want to 
> 1>define a
> new data frame z such that z[1] = (a[1] b[1] c[1]), z[2] = (a[2] b[2] 
> c[2]) and so on...how do i do it in R
> 

z <- data.frame(a, b, c)


> 
> 2> Then i want to draw bootstrap samples from z.

Look at the boot package. 

MW

> 
> Kindly suggest how i can do this in R.
> 
> Thanks,
> Preetam
> --
> Preetam Pal
> (+91)-9432212774
> M-Stat 2nd Year,                                             Room No.
N-114
> Statistics Division,                                           C.V.Raman
> Hall
> Indian Statistical Institute,                                 B.H.O.S.
> Kolkata.
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

______________________________________________
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.



More information about the R-help mailing list