diff --git a/joins.qmd b/joins.qmd index 0f89889..25d0167 100644 --- a/joins.qmd +++ b/joins.qmd @@ -673,7 +673,7 @@ In equi joins the `x` keys and `y` are always equal, so we only need to show one We can request that dplyr keep both keys with `keep = TRUE`, leading to the code below and the re-drawn `inner_join()` in @fig-inner-both. ```{r} -x |> left_join(y, by = "key", keep = TRUE) +x |> inner_join(y, join_by(key == key), keep = TRUE) ``` ```{r} @@ -771,7 +771,7 @@ One small useful technique is to use them to restrict the cross join so that ins ```{r} df <- tibble(id = 1:4, name = c("John", "Simon", "Tracy", "Max")) -df |> left_join(df, join_by(id < id)) +df |> inner_join(df, join_by(id < id)) ``` ### Rolling joins @@ -811,6 +811,7 @@ parties <- tibble( Now imagine that you have a table of employee birthdays: ```{r} +set.seed(123) employees <- tibble( name = sample(babynames::babynames$name, 100), birthday = ymd("2022-01-01") + (sample(365, 100, replace = TRUE) - 1)