Learn R Programming

camtrapR (version 0.97.0)

appendSpeciesNames: Add or remove species name from image filenames

Description

Function to add or remove species names from jpg image filenames. Images must be sorted into station directories and species subdirectories.

Usage

appendSpeciesNames(inDir, 
  removeNames = FALSE, 
  writecsv = FALSE
)

Arguments

inDir
Directory containing station directories with renamed and identified images in species directories
removeNames
logical. remove appended species names?
writecsv
logical. write csv table containing old and new file names into inDir?

Value

  • A data frame containing the old and new file names and directories.

Details

Species names can be appended or removed. If species names were appended several times by accident, they can all be removed by running the function with removeNames = TRUE. Before running the function, you may want to run checkSpeciesFolders to detect possible misidentifications.

Examples

Run this code
# define image directory
wd_images_ID <- system.file("pictures/sample_images", package = "camtrapR")
file.copy(from = wd_images_ID, to = getwd(), recursive = TRUE)
wd_images_ID_copy <- paste(getwd(), "sample_images", sep = "/")

# append species names
SpecNameAppend1 <- appendSpeciesNames(inDir = wd_images_ID_copy,
  removeNames = FALSE,
  writecsv = FALSE)
  
SpecNameAppend1

# remove species names
SpecNameRemove1 <- appendSpeciesNames(inDir = wd_images_ID_copy,
  removeNames = TRUE,
  writecsv = FALSE)
  
SpecNameRemove1

Run the code above in your browser using DataLab