[R] Drawing sub-samples

Anirudh V. S. Ruhil ruhil at ohio.edu
Thu Mar 8 20:09:38 CET 2007


Folks,

I have a dataframe (snippet shown below).

>  demo.df[1:10, 1:6]
    dirn   county year exp 	exp.wave 	r3
1  43901 Cuyahoga 2006    0         0 56
2  49098 Pickaway 2006    0         0 77
3  44164  Portage 2006    0         0 85
4  44610    Wayne 2006    1         1 76
5  45120    Wayne 2006    0         0 82
6  49593   Scioto 2006    1         1 89
7  46516 Crawford 2006    0         0 75
8  50054   Summit 2006    0         0 92
9  48231    Lucas 2006    0         0 79
10 49908    Stark 2006    0         0 90

If I need to draw all possible samples of size n (where n = 30, n = 50, and 
so on), and run a particular linear model on each subsample of a specific 
size, then tabulate coeffs on specific covariates for subsequent 
manipulation/graphical representation, what would be the best means of 
doing so?

"sample.1 <- sample(demo.df, 30, replace = FALSE)"

doesn't work; it just gives me the entire population in demo.df. What am I 
missing?

thanks in advance

Ani

Anirudh V. S. Ruhil, Ph.D.
Sr. Research Associate
Voinovich Center for Leadership and Public Affairs
Ohio University
Building 21, The Ridges
Athens, OH 45701-2979
Tel: 740.597.1949 | Fax: 740.597.3057



More information about the R-help mailing list