suppressPackageStartupMessages({
library(dplyr)
})
dat1 <- structure(list(deviceNr = "F150", something = 51, timestamp = structure(1532753784,
class =
c("POSIXct", "POSIXt"), tzone = "UTC"
), latitude = "X", longitude = "X"),
class =
c("spec_tbl_df", "tbl_df", "tbl", "data.frame"),
row.names =
c(NA, -1L), spec = structure(list(cols = list(name = structure(list(),
class =
c("collector_character", "collector")
), deviceNr = structure(list(),
class =
c("collector_double", "collector")
), timestamp = structure(list(format = ""),
class =
c("collector_datetime", "collector")
), latitude = structure(list(),
class =
c("collector_character", "collector")
), longitude = structure(list(),
class =
c("collector_character", "collector")
)), default = structure(list(),
class =
c("collector_guess", "collector")
), skip = 1L),
class = "col_spec"
)
)
dat2 <- structure(list(deviceNr = "F150", deviceId = "X", timestamp = structure(1527483549,
class =
c("POSIXct", "POSIXt"), tzone = "UTC"
), peerId = 140, TIME = structure(1527483069,
class =
c("POSIXct", "POSIXt"), tzone = "UTC"
), peerId2 = "F140"),
class =
c("spec_tbl_df", "tbl_df", "tbl", "data.frame"),
row.names =
c(NA, -1L), spec = structure(list(cols = list(deviceNr = structure(list(),
class =
c("collector_character", "collector")
), deviceId = structure(list(),
class =
c("collector_character", "collector")
), timestamp = structure(list(format = ""),
class =
c("collector_datetime", "collector")
), peerId = structure(list(),
class =
c("collector_double", "collector")
), TIME = structure(list(format = ""),
class =
c("collector_datetime", "collector")
), peerId2 = structure(list(),
class =
c("collector_character", "collector")
)), default = structure(list(),
class =
c("collector_guess", "collector")
), skip = 1L),
class = "col_spec"
)
)
inner_join(dat1, dat2, by = "deviceNr")
#> # A tibble: 1 x 10
#> deviceNr something timestamp.x latitude longitude deviceId
#> <chr> <dbl> <dttm> <chr> <chr> <chr>
#> 1 F150 51 2018-07-28 04:56:24 X X X
#> # … with 4 more variables: timestamp.y <dttm>, peerId <dbl>, TIME <dttm>,
#> # peerId2 <chr>