Suffix doesn´t work in left join

I've used this code

df_COMPARA <- df_CONV %>%
  left_join(agg_df_DATA_SOURCE, by = c("PAIS_COD", "NC2"), suffix = c("_ASSIM_NEGATIVAS", "_DATA_SOURCE_4_5_6"))

but it doesn't puts the suffix on the variables. What might be happening?

Hi Rui,

It's difficult to diagnose your problem without a reproducible example.

Your syntax looks like it should do the job:

#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>     filter, lag
#> The following objects are masked from 'package:base':
#>     intersect, setdiff, setequal, union

dat <-
  tibble(id = 1:3,
         name = c("Andy", "Bob", "Charlie"))

left_join(dat, dat, by = "id", suffix = c("_lhs", "_rhs"))
#> # A tibble: 3 × 3
#>      id name_lhs name_rhs
#>   <int> <chr>    <chr>   
#> 1     1 Andy     Andy    
#> 2     2 Bob      Bob     
#> 3     3 Charlie  Charlie

Created on 2023-05-17 with reprex v2.0.2

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.