random_files: Randomly sample files in a directory

View source: R/RandomFiles.R

random_filesR Documentation

Randomly sample files in a directory

Description

RandomFiles will randomly sample files from a directory and optionally its internal folders

Usage

random_files(
  path,
  percent_number,
  pattern = "jpg$|JPG$",
  folders = TRUE,
  results = "Q:/Waterfowl/STEI_Survey/Data/RandomFiles"
)

Arguments

path

The path to the folder containing files to be sampled (or folders of files).

percent_number

The percent (if less than 1.0) or raw number (if greater than 1.0) of files to sample.

pattern

The file extension of the requested sample.

folders

Should nested folders also be searched? TRUE/FALSE

results

The folder path for the copied (sampled) output

Details

RandomFiles was designed to randomly sample systematic photos of a sampled area for analysis. It is generalized to use any file extension a user inputs. Files are copied and a lookup table is generated to crosswalk original and new names.

Value

copies randomly selected files to results directory and writes a lookup key selected_files.csv

Author(s)

Charles Frost, charles_frost@fws.gov

References

https://github.com/cfrost3/AKaerial

Examples

 RandomFiles(path = "C:/DATA/PHOTOS", percent_number = 0.10, pattern = "jpg$|JPG$", folders = TRUE, results = "C:/RESULTS")


USFWS/AKaerial documentation built on April 3, 2025, 4:06 p.m.