Re: [R-sig-eco] Problem in generate random samples in r

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [R-sig-eco] Problem in generate random samples in r

Roman Luštrik
My guess would be that absences_150000 doesn't have 10000 rows. Can you
confirm or refute this?

Cheers,
Roman

On Wed, Feb 20, 2019 at 12:20 PM Lara Silva <[hidden email]>
wrote:

> Hello,
>
> I am trying to generate random samples from the following code
>
> ### Setting random seed to always create the same
> ### Random set of points
> set.seed(0)
>
> absences_15000<-absences[sample(nrow(absences), 15000),]
> points(absences_15000, cex=0.1)
>
> ## Subsample_10000
> set.seed(0)
>
> absences_10000<-absences_15000[sample(nrow(absences_15000), 10000),]
> dim(absences_10000)
>
> I get the following error:
>
> Error in sample.int(length(x), size, replace, prob) :
>   cannot take a sample larger than the population when 'replace = FALSE'
>
> Any advice?
>
> Regards,
>
> Lara
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>


--
In God we trust, all others bring data.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo