vendredi 1 juillet 2016

random subsample with uniform distribution in R

I have a large dataset containing observations of Vegetation Indicies (VI). I'm using R to randomly subsample the data while keeping the distribution (rel. frequency) uniform (equal amounts of observations over the entire VI range). I haven't been able to get quite an even distribution.

Example:

norm<-rnorm(1000, mean = .5, sd = .25) #i have this 

hist(norm) #that is distributed like this

hist(unif<-runif(1000, min=0, max=1)) #but i want to resample the data to look like this

Thank you!




Aucun commentaire:

Enregistrer un commentaire