I ended up just manipulating the data frame to produce what I needed. Here is some example code of what I did to convert the standard output from camtrapR (where each camera was a row) into something I could use for RPresence. First, I added a column to the camtrapR operations dataframe output (cameraOperation function) that numbered the cameras per site by grouping by site year and using the row_numbers function. So if there were 3 cameras at a site, then they would get numbered 1, 2, 3 etc. Then I subset that frame to just include the site id and number of cameras. Then I joined that to the detection history data frame based on the site id column. Hopefully you can follow the rest of the pasted code below? As a disclaimer, I suspect there are much more efficient ways to do this, but this is what worked for me.
#Attach the camera number info to the detection history data frame
dh_pred_10 <-
dh_pred_10 %>%
rownames_to_column(var = "year_site_camid") %>%
left_join(., cam_num, by="year_site_camid")
#now subset the data by cam number to set up the wide data frame by "method"
#I had up to 4 cameras per site, so if you only had 2 then you would just need the first 2 chunks etc....
dh_pred_10_1 <-
dh_pred_10 %>%
filter(cam_num == 1)
dh_pred_10_2 <-
dh_pred_10 %>%
filter(cam_num == 2)
dh_pred_10_3 <-
dh_pred_10 %>%
filter(cam_num == 3)
dh_pred_10_4 <-
dh_pred_10 %>%
filter(cam_num == 4)
#now join the data frames back together in wide form and add a suffix to the respective observations
df_pred_10 <-
dh_pred_10_1 %>%
left_join(.,dh_pred_10_2, by=c("year_site"), suffix=c("","_cam2")) %>%
left_join(., dh_pred_10_3, by=c("year_site"), suffix=c("","_cam3")) %>%
left_join(., dh_pred_10_4, by=c("year_site"), suffix=c("","_cam4"))
#now organize the data frames so the occasions are all together, this depends on how many occasions you have but will sort them the way you need them for Presence
dh_pred_10 <-
df_pred_10 %>%
dplyr::select(o1, starts_with("o1_"),o2, starts_with("o2_"),o3, starts_with("o3_"),
o4, starts_with("o4_"), o5, starts_with("o5_"), o6, starts_with("o6_"),
o7, starts_with("o7_"), o8, starts_with("o8_"), o9, starts_with("o9_"),
everything())
#subset to replace dots with NAs in the detection history
dh_pred_10_subset <- dh_pred_10[1:36] #grabs only the detection history data, will vary depending on the number of observations and cameras in your data
dh_pred_10_subset <- data.matrix(dh_pred_10_subset)
Hopefully this helpful.