abalter
abalter

Reputation: 10383

R bench package gives a strange error when I try to use the tidytable package

I'm trying to augment the benchmarks in this article with the tidytable package](https://www.tidyverse.org/blog/2023/04/performant-packages/#tools-of-the-trade).

When I add tidytable to a benchmark, I get a strange error:

Error: Each result must equal the first result: t_tidytable does not equal t_dplyr

library(dtplyr)
library(tidyverse)
library(profvis)
library(bench)
library(vctrs)
#> 
#> Attaching package: 'vctrs'
#> The following object is masked from 'package:dplyr':
#> 
#>     data_frame
#> The following object is masked from 'package:tibble':
#> 
#>     data_frame
library(data.table)
#> 
#> Attaching package: 'data.table'
#> The following objects are masked from 'package:lubridate':
#> 
#>     hour, isoweek, mday, minute, month, quarter, second, wday, week,
#>     yday, year
#> The following objects are masked from 'package:dplyr':
#> 
#>     between, first, last
#> The following object is masked from 'package:purrr':
#> 
#>     transpose

mtcars_tbl = tibble::as_tibble(mtcars, rownames = "make_model")

res =
  bench::mark(
    t_dplyr = dplyr::filter(mtcars_tbl, hp > 100),
    t_vctr = vec_slice(mtcars_tbl, mtcars_tbl$hp > 100),
    t_datatable = mtcars_tbl[mtcars_tbl$hp > 100, ]
  ) %>%
  select(expression, median)

res =
  bench::mark(
    t_tidytable = tidytable::filter(mtcars_tbl, hp > 100),
    t_dplyr = dplyr::filter(mtcars_tbl, hp > 100),
    t_vctr = vec_slice(mtcars_tbl, mtcars_tbl$hp > 100),
    t_datatable = mtcars_tbl[mtcars_tbl$hp > 100, ]
  ) %>%
  select(expression, median)
#> Error: Each result must equal the first result:
#> `t_tidytable` does not equal `t_dplyr`

Created on 2023-04-29 with reprex v2.0.2

Upvotes: 0

Views: 122

Answers (0)

Related Questions