Hi Rachel,

Here is a suggestion:

index <- sample(100)
mysample <- gly[index, ]
mysample

See ?sample for more information.

HTH,
Jorge


On Fri, Nov 13, 2009 at 5:20 PM, Hayes, Rachel M <> wrote:

> Hi All,
>
>
>
> I want to take a simple random sample from a large dataset, gly, but I'm
> getting an error message.  Any help?
>
>
>
> dim(gly)
>
> [1] 112371     37
>
> > s1 <- sample(gly,100)
>
> Error in `[.data.frame`(x, .Internal(sample(length(x), size, replace,  :
>
>
>  cannot take a sample larger than the population when 'replace = FALSE'
>
>
>
> Thanks,
>
>
>
> Rachel
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
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