MatthieuStigler / matPkg

Other
2 stars 0 forks source link

Bug with new version of pryr? Getting bad binding access #62

Open MatthieuStigler opened 3 years ago

MatthieuStigler commented 3 years ago

See:

library(tidyverse)

iris_regs <- nest(iris, data=-Species) %>%
  mutate(reg_out = map(data, ~lm(Petal.Width~Petal.Length, data=iris))) %>%
  select(-data)

reg_simp <- lm(Petal.Width~Petal.Length, data=iris)
reg_simp %>% pryr::object_size()
#> Registered S3 method overwritten by 'pryr':
#>   method      from
#>   print.bytes Rcpp
#> 28.2 kB
tibble(a=list(reg_simp))$a[[1]] %>% pryr::object_size()
#> 28.2 kB

iris_regs$reg_out[[1]] %>% pryr::object_size()
#> Error in object_sizes(list(...), env): bad binding access

Created on 2021-04-16 by the reprex package (v1.0.0)

MatthieuStigler commented 3 years ago

Could be session dependent! This works in reprex, not in my session:

library(tidyverse)
df_size <- tibble(object = ls(.GlobalEnv, all.names=all.names)) %>%
  mutate(obj_size = map(.data$object, ~pryr::object_size(get(., envir = .GlobalEnv))))

Created on 2021-04-16 by the reprex package (v1.0.0)