Skip to contents

Filter data to keep only rows where cameras are in both tables

Usage

filter_cameras_in_both_tables(
  dfrec,
  dfcam,
  cam_col_dfrec,
  cam_col_dfcam = cam_col_dfrec
)

Arguments

dfrec

Records dataframe

dfcam

Cameras dataframe

cam_col_dfrec

Name of the column with cameras names in dfrec

cam_col_dfcam

Name of the column with cameras names in dfcam If NULL will be assumed to be the same as cam_col_dfrec.

Value

A list of two dataframes with filtered values:

  • $records is the records dataframe

  • $cameras is the cameras dataframe

Examples

dfrec <- data.frame(species = c("pigeon", "mouse", "pigeon", "mouse"),
                      stamp = Sys.time() + seq(60, length.out = 4, by = 60),
                      camera = c("A", "B", "C", "E"))
dfcam <- data.frame(camera = c("A", "B", "C", "D"), 
                      lat = c(20.12, 20.22, 22.34, 21.35),
                      lon = c(33.44, 33.45, 33.42, 33.53))
filter_cameras_in_both_tables(dfrec, dfcam, 
                              cam_col_dfrec = "camera")
#> $records
#>   species               stamp camera
#> 1  pigeon 2024-06-11 12:56:36      A
#> 2   mouse 2024-06-11 12:57:36      B
#> 3  pigeon 2024-06-11 12:58:36      C
#> 
#> $cameras
#>   camera   lat   lon
#> 1      A 20.12 33.44
#> 2      B 20.22 33.45
#> 3      C 22.34 33.42
#>