View source: R/appendSpeciesNames.R
appendSpeciesNames | R Documentation |
Add or remove species names from JPEG image filenames. It makes it easier to find images of a species.
appendSpeciesNames(
inDir,
IDfrom,
hasCameraFolders,
metadataSpeciesTag,
metadataHierarchyDelimitor = "|",
removeNames = FALSE,
writecsv = FALSE
)
inDir |
character. Directory containing camera trap images sorted into station subdirectories (e.g. inDir/StationA/) |
IDfrom |
character. Read species ID from image metadata ("metadata") of from species directory names ("directory")? |
hasCameraFolders |
logical. Do the station subdirectories of
|
metadataSpeciesTag |
character. The species ID tag name in image metadata (if IDfrom = "metadata"). |
metadataHierarchyDelimitor |
character. The character delimiting hierarchy levels in image metadata tags in field "HierarchicalSubject". Either "|" or ":". |
removeNames |
logical. remove appended species names? |
writecsv |
logical. write csv table containing old and new file names
into |
Species names can be appended or removed from image filenames. Before
running the function, you may want to run
checkSpeciesIdentification
to detect possible
misidentifications. As an example, the function would change an image file
name from "StationA__2015-05-41__20-59-59(1).JPG" to
"StationA__2015-05-41__20-59-59(1)__Species Name.JPG". If species names were
appended several times by accident, they can all be removed by running the
function with removeNames = TRUE
A data.frame
containing the old and new file names and
directories.
Juergen Niedballa
## Not run:
# copy sample images to another location (so we don't mess around in the package directory)
wd_images_ID <- system.file("pictures/sample_images_species_dir", package = "camtrapR")
file.copy(from = wd_images_ID, to = getwd(), recursive = TRUE)
wd_images_ID_copy <- file.path(getwd(), "sample_images_species_dir")
# append species names
SpecNameAppend1 <- appendSpeciesNames(inDir = wd_images_ID_copy,
IDfrom = "directory",
hasCameraFolders = FALSE,
removeNames = FALSE,
writecsv = FALSE)
SpecNameAppend1
# remove species names
SpecNameRemove1 <- appendSpeciesNames(inDir = wd_images_ID_copy,
IDfrom = "directory",
hasCameraFolders = FALSE,
removeNames = TRUE,
writecsv = FALSE)
SpecNameRemove1
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.