table.express
table.express copied to clipboard
left_join omits join stats when table.express is loaded
Hi all,
When table.express is not loaded, dplyr gives these join stats (rows only ... etc), but when table.express is loaded that section doesn't show up. Took me a while to find where the problem was coming from. This package looks really powerful, so I was wondering if there was a way to implement the same stats dplyr shows? Apologies if I'm missing smth here.
> band_members %>% inner_join(band_instruments)
Joining, by = "name"
inner_join: added one column (plays)
> rows only in x (1)
> rows only in band_instruments (1)
> matched rows 2
> ===
> rows total 2
# A tibble: 2 × 3
name band plays
<chr> <chr> <chr>
1 John Beatles guitar
2 Paul Beatles bass
Hi there. I don't think there's much I can do about this. Those stats you mention come from dplyr
, but when you use table.express
, only the "verbs" are the same, the backend is meant to be data.table
without much intervention from my part. So, when you use table.epxress
and pass a data.table
, the former doesn't actually do anything with your data, it just creates an expression that is evaluated by the latter, and the latter doesn't have any such stats. You would have to request that functionality directly in data.table
.
Thank you! Is there any way to load table.express but still use normal dplyr verbs unless specified otherwise? Even if I use dplyr::left_join with table.express loaded, R still doesn't show join stats.
Mm if it's your top-level code, you could force a specific method with 3 colons and the full function name: dplyr:::left_join.data.frame()
, but that wouldn't work inside other packages, even packages you create yourself. Would you need that?
Ah I think you could just convert to a normal data frame with data.table::setDF()
before calling left_join
(with 2 colons or none).
I got it. It was "tidylog" package that was showing those stats! I just loaded it after table.express. Thank you!
> p_load(table.express)
> p_load(frenchdata)
> p_load(tidylog)
> band_members %>% inner_join(band_instruments)
Joining, by = "name"
inner_join: added one column (plays)
> rows only in x (1)
> rows only in band_instruments (1)
> matched rows 2
> ===
> rows total 2
# A tibble: 2 × 3
name band plays
<chr> <chr> <chr>
1 John Beatles guitar
2 Paul Beatles bass
>