Hello everyone,
I was trying to plot activity density after generate record table when the first error occurred. The first error was as below:
> str(rec.table60)
'data.frame': 201 obs. of 14 variables:
$ Station : chr "MD01" "MD01" "MD01" "MD01" ...
$ Species : chr "Leopard" "Lesser Mousedeer" "Malayan Porcupine" "Malayan Porcupine" ...
$ DateTimeOriginal : POSIXct, format: "2022-08-07 17:03:37" "2022-08-17 14:43:42" ...
$ Date : Date, format: "2022-08-07" "2022-08-17" ...
$ Time : chr "17:03:37" "14:43:42" "21:47:33" "20:58:07" ...
$ delta.time.secs : num 0 0 0 688233 351363 ...
$ delta.time.mins : num 0 0 0 11470 5856 ...
$ delta.time.hours : num 0 0 0 191.2 97.6 ...
$ delta.time.days : num 0 0 0 8 4.1 0.1 1 0.2 1.8 0 ...
$ Directory : chr "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Leopard" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Lesser Mousedeer" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Malayan Porcupine" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Malayan Porcupine" ...
$ FileName : chr "MD01__1__2022-08-07__17-03-37(1).JPG" "MD01__1__2022-08-17__14-43-42(1).JPG" "MD01__1__2022-08-04__21-47-33(1).JPG" "MD01__1__2022-08-12__20-58-07(1).JPG" ...
$ metadata_EnglishName: chr "NA" "NA" "NA" "NA" ...
$ n_images : int 2 2 2 2 2 1 2 2 5 2 ...
$ HierarchicalSubject : chr "English Name|LEOPARD" "English Name|LESSER MOUSE DEER" "English Name|MALAYAN PORCUPINE" "English Name|MALAYAN PORCUPINE" ...
> activityDensity(recordTable = rec.table60,
+ species = "Red Junglefowl",
+ allSpecies = FALSE,
+ speciesCol = "Species",
+ recordDateTimeCol = "DateTimeOriginal",
+ recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
+ plotR = TRUE,
+ # writePNG = FALSE,
+ # plotDirectory,
+ #createDir = FALSE,
+ #pngMaxPix = 1000,
+ add.rug = TRUE
+ )
datetime column is in POSIXct format. Converting to character: recordTable[, recordDateTimeCol] FALSE
Error: 3 out of 201 records in c("2022-08-07 17:03:37", "2022-08-17 14:43:42", "2022-08-04 21:47:33", cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 1713 out of 201 records in "2022-08-12 20:58:07", "2022-08-16 22:34:11", "2022-08-17 01:59:27", cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 1713 out of 201 records in "2022-08-18 01:06:38", "2022-08-18 06:36:19", "2022-08-20 00:34:11", cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 1713 out of 201 records in "2022-08-22 05:06:56", "2022-08-16 17:01:45", "2022-08-17 16:40:36", cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 1713 out of 201 records in "2022-08-19 18:04:09", "2022-08-19 19:44:31", "2022-08-20 06:39:23", cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 1713 out of 201 records in "2022-08-02 12:17:00", "2022-08-22 10:31:01", "2022-08-02 23:18:07", cannot be interpr
I have gone through this forum and read threads about almost similar errors to mine. I thought the error was related to the datetime format in POSIXct format and tried to convert to character before running activityDensity. However, I came across another error below:
> rec.table60$DateTimeOriginal <- as.character(rec.table60$DateTimeOriginal)
> str(rec.table60)
'data.frame': 201 obs. of 14 variables:
$ Station : chr "MD01" "MD01" "MD01" "MD01" ...
$ Species : chr "Leopard" "Lesser Mousedeer" "Malayan Porcupine" "Malayan Porcupine" ...
$ DateTimeOriginal : chr "2022-08-07 17:03:37" "2022-08-17 14:43:42" "2022-08-04 21:47:33" "2022-08-12 20:58:07" ...
$ Date : Date, format: "2022-08-07" "2022-08-17" ...
$ Time : chr "17:03:37" "14:43:42" "21:47:33" "20:58:07" ...
$ delta.time.secs : num 0 0 0 688233 351363 ...
$ delta.time.mins : num 0 0 0 11470 5856 ...
$ delta.time.hours : num 0 0 0 191.2 97.6 ...
$ delta.time.days : num 0 0 0 8 4.1 0.1 1 0.2 1.8 0 ...
$ Directory : chr "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Leopard" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Lesser Mousedeer" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Malayan Porcupine" "C:/Users/Dell/Desktop/Main Dam/imageRENAMED/MD01/Malayan Porcupine" ...
$ FileName : chr "MD01__1__2022-08-07__17-03-37(1).JPG" "MD01__1__2022-08-17__14-43-42(1).JPG" "MD01__1__2022-08-04__21-47-33(1).JPG" "MD01__1__2022-08-12__20-58-07(1).JPG" ...
$ metadata_EnglishName: chr "NA" "NA" "NA" "NA" ...
$ n_images : int 2 2 2 2 2 1 2 2 5 2 ...
$ HierarchicalSubject : chr "English Name|LEOPARD" "English Name|LESSER MOUSE DEER" "English Name|MALAYAN PORCUPINE" "English Name|MALAYAN PORCUPINE" ...
> activityDensity(recordTable = rec.table60,
+ species = "Red Junglefowl",
+ allSpecies = FALSE,
+ speciesCol = "Species",
+ recordDateTimeCol = "DateTimeOriginal",
+ recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
+ plotR = TRUE,
+ # writePNG = FALSE,
+ # plotDirectory,
+ #createDir = FALSE,
+ #pngMaxPix = 1000,
+ add.rug = TRUE
+ )
Error: 3 out of 201 records in recordTable[, recordDateTimeCol] cannot be interpreted using dateTimeFormat: %Y-%m-%d %H:%M:%S
rows 169, 170, 171
I also tried changing the recordDateTimeFormat to "ymd HMS" but to no avail.
Thank you.
Regards,
Bazilah