Hello,
there is currently no built-in function in camtrapR to achieve this.
Since you can extract the UserComment with recordTable(), you can call Exiftool from R to write the content of usercomment to the HierarchicalSubject tag though (which digiKam reads).
Here's the rough idea (for assigning the value in the column UserComment of the record table to a tag "Species" in the HierarchicalSubject field in the image metadata:
species_tag <- paste("Species", rec$UserComment, sep = "|")
exif_call <- paste0('exiftool -hierarchicalsubject+="', species_tag, '" ', file.path(rec$Directory, rec$FileName))
system(exif_call) # for one image
sapply(exif_call, system) # for multiple images
system(paste('exiftool -HierarchicalSubject ', file.path(rec$Directory[1], rec$FileName[1]))) # for checkingIt is quite clumsy and very slow since it calls exiftool for each image separately. Performance can be increased by parallelization (e.g. parSapply).
Alternatively, one can probably achieve the same with Exiftool for entire directories instead of files, either from the command line or within R using a system call.
One can copy values from one metadata tag to another (see e.g.
here), but here we need to copy it as structured information (e.g. with a prefix "Species|" in HierarchicalSubject). I don't know how to do that in Exiftool and don't have code to share. The Exiftool forum (
https://exiftool.org/forum/) might be a good place to find help on that though, and there were some similar questions in the past already. If there is a solution please share, then I can maybe add it to camtrapR in the future.
Either way, in digiKam one needs to click "Read metadata from file to database" to see the newly assigned tags.
Best regards,
Jürgen