I am performing creel surveys and am attempting to construct a random date generator that weights the weekends higher than the weekdays. So far I have a simplistic random date generator that does not take into account the day type. We expect more angling pressure on the weekends (as that is when more people have time to fish) but do not have a way to select random days without including bias. I would like to select 15 days within a given month.
I've already generated a simplistic random date generator:
dates <- data.frame(seq.Date(as.Date(day.start),as.Date(day.end),by="day"))
dates
sample(dates$seq.Date.as.Date.day.start...as.Date.day.end...by....day.., size = 15, replace = FALSE)
[1] "2019-11-10" "2019-11-06" "2019-11-04" "2019-11-27" "2019-11-30" "2019-11-15"
[7] "2019-11-18" "2019-11-21" "2019-11-13" "2019-11-01" "2019-11-19" "2019-11-25"
[13] "2019-11-07" "2019-11-02" "2019-11-23"
Ideally I would have an end product that allows me to input the month start and end and outputs 15 random days.
Aucun commentaire:
Enregistrer un commentaire