dimanche 18 décembre 2016

Selecting random numbers or Times across a moving window in R

I have a data frame of images collected along a transect. The idea is that we want to randomly sample across the images (approx 1000 per transect). We want to do this by selecting them randomly across a moving window (consisting of either 20/30 seconds, or of every 10-15 records). So select 1 image in the first 20 seconds of the mission, 1 from 21-40 seconds, and so on.

Useful fields include:

Date.Time (factor) in format: 20161102 101440
Date.Time.Local (POSIXct) in format: 2016-11-02 10:14:40
Mission.Time (int): 192 (seconds into mission, will not start at 1 for usable images and goes up by 2-3 each time)
FILENAME (factor): 20161102_hb01_0049.jpg

If it is possible to spit out the filename selected with the randomly selected record that would be an added bonus.

Any help would be great as I can currently only think of very lengthy ways to do this by defining the range to select each one seperately but this also wouldn't be reproducible across transects




Aucun commentaire:

Enregistrer un commentaire