pages <- data.frame(
URL = c("http://example.com:80/a", "https://example.com/b",
"http://example.com/c?", "not a url"),
clicks = c(10, 20, 30, 40),
stringsAsFactors = FALSE
)
meta <- data.frame(
URL = c("http://example.com/a", "http://example.com/b",
"http://example.com/c"),
title = c("A", "B", "C"),
stringsAsFactors = FALSE
)
# Only row 1 matches: `:80` is redundant under http, but http is not https,
# and a present-but-empty query is not the same resource as no query.
url_inner_join(pages, meta, by = "URL")
# Every left row survives, unmatched ones with a typed missing payload.
url_left_join(pages, meta, by = "URL")
# Rows that could not be parsed at all.
url_anti_join(pages, meta, by = "URL")
# Expose the key you matched on.
url_inner_join(pages, meta, by = "URL", key_name = "key")
# Relaxing scheme equality brings row 2 in.
url_inner_join(pages, meta, by = "URL",
policy = url_key_policy(scheme_equality = "http_https"))
Run the code above in your browser using DataLab