Skip to content

Are the packages of S3 methods being found? #46

@DavisVaughan

Description

@DavisVaughan

I've had two reports over in furrr where packages are not loaded because the only thing used in the expression are S3 generics where the generic doesn't come from the package, but the method does (for example, [ is in base R, but [.data.table is in data table). Does globals find these?

Here is an example:

library(data.table)
library(future.apply)
#> Loading required package: future

dt_cars <- data.table(mtcars)

plan(multiprocess, workers = 2)

future_lapply(1:4, function(x) {head(dt_cars[carb %in% 1], 2)})
#> Error in carb %in% 1: object 'carb' not found

future_lapply(1:4, function(x) {library(data.table); head(dt_cars[carb %in% 1], 2)})
#> [[1]]
#>     mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> 1: 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
#> 2: 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
#> 
#> [[2]]
#>     mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> 1: 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
#> 2: 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
#> 
#> [[3]]
#>     mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> 1: 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
#> 2: 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
#> 
#> [[4]]
#>     mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> 1: 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
#> 2: 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1

Created on 2019-06-11 by the reprex package (v0.2.1)

Here are the two issues:
futureverse/furrr#72

futureverse/furrr#73

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions