that's strange, it worked for me after creating a sample camera trap table and record table from the str() output you shared. It worked for both lubridate format and the base R date/time formats. See code and output below. But it was only for 3 or 4 rows of your data, so maybe the problem is further below in your input tables.
Which version of camtrapR are you using? And do you get the same error when you use lubridate format? Also, can you check that all dates in the camera trap table are in the same format (ymd). If none of this helps please feel free to share / email me a sample data set to identify the issue.
Thank you.
rc.table <- data.frame(station = c("UMT001", "UMT001", "UMT001"),
species = c("Common-palm-civet", "Common-palm-civet", "Greater-coucal"),
FileName = c("IMG_0001.MP4", "IMG_0044.MP4", "IMG_0005.MP4"),
DateTimeOriginal = c("2020-02-22 22:00:00", "2020-03-07 20:52:10", "2020-02-26 15:27:18"),
Directory = "F:\\SVW research\\U Minh\\U Minh Thuong NP\\Camera-trapping\\Targeted\\Fishing Cat_U Minh Thuong_2019 2020\\Raw")
CTtable <- data.frame(
station = c("UMT001", "UMT002", "UMT003", "UMT004"),
utm_x = c(511132, 509292, 512110, 508691),
utm_y = c(1061373, 1064941, 1060784, 1063603),
setup_date = as.Date(c("2020-02-20", "2020-02-19", "2020-02-20", "2020-02-19")), # for testing, class "Date" works
retrieval_date= c("2020-05-15", "2020-05-15", "2020-05-15", "2020-05-15"), # character also works
Problem1_from = c("2020-03-20", NA, "2020-02-21", "2020-02-20"),
Problem1_to = c("2020-05-15", NA, "2020-05-15", "2020-05-15"))
stationCol = "station", CTDateFormat = "ymd", recordDateTimeCol = "DateTimeOriginal", recordDateTimeFormat = "ymd HMS",
CTHasProblems = TRUE)
$survey_dates
station setup_date first_image_date last_image_date retrieval_date n_nights_total n_nights_active n_cameras
1 UMT001 2020-02-20 2020-02-22 2020-03-07 2020-05-15 85 29 1
2 UMT002 2020-02-19 <NA> <NA> 2020-05-15 86 86 1
3 UMT003 2020-02-20 <NA> <NA> 2020-05-15 85 1 1
4 UMT004 2020-02-19 <NA> <NA> 2020-05-15 86 1 1
$species_by_station
station n_species
1 UMT001 2
$events_by_species
species n_events n_stations
1 Common-palm-civet 2 1
2 Greater-coucal 1 1
$events_by_station
station species n_events
1 UMT001 Common-palm-civet 2
2 UMT001 Greater-coucal 1
$events_by_station2
station species n_events
1 UMT001 Common-palm-civet 2
2 UMT001 Greater-coucal 1