> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Michael Bedward
> Sent: Wednesday, September 29, 2010 5:34 PM
> To: Michael Larkin; Rhelp
> Subject: Re: [R] repeat a function
> 
> On 30 September 2010 02:48, Michael Larkin <mlar...@rsmas.miami.edu>
> wrote:
> > >
> > > testdat <- replicate( 50, growth[ sample(nrow(growth), 8, rep=TRUE)
> ] )
> >
> > I can't seem to get it to work.  I keep getting the error message of
> > "undefined columns selected"
> >
> > Any advice?
> 

Michael,

As has been pointed out, you seem to be trying to reinvent the wheel.  But to 
answer your question, you need a comma just before the final square bracket. 
Then you need to set the simplify=FALSE parameter for the replicate function.  
So something like this

testdat <- replicate( 50, growth[sample(nrow(growth), 8, rep=TRUE),], 
simplify=FALSE)


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
R-help@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.

Reply via email to