Skip to content

in_parallel() causes R-CMD-check error on Windows #1229

@padpadpadpad

Description

@padpadpadpad

I am parallelising some code for an R package I maintain. I want to resubmit this to CRAN, but it fails the GitHub Actions R-CMD-check, but only for Windows latest release.

All the other platforms pass. The code that fails is the in_parallel() code I think, I get the error:

ℹ In argument: `mods = map(...)`.
Caused by error in `map()`:
ℹ In index: 1.
Caused by error in `library()`:
! there is no package called 'rTPC' 

But I cannot work out why. Reproducible code is below. Is there something I am missing? quickfit_tpc_multi() is a function of rTPC, I have also tried rTPC::quickfit_tpc_multi() and the same problem persists.

# load in packages
library(rTPC)
library(nls.multstart)
library(broom)
library(tidyverse)
library(mirai)

# load in data
data('chlorella_tpc')
d <- chlorella_tpc
head(d)

# start timer
parallel_start <- Sys.time()

# start parallel session
daemons(3)

# fit models as before, but in parallel
d_mods_para <- d %>%
  nest(data = c(temp, rate)) %>%
  mutate(
    mods = map(
      data,
      in_parallel(
        \(x) {
          library(rTPC)
          quickfit_tpc_multi(
            data = x,
            c(
              "briereextended_2021",
              "gaussianmodified_2006",
              "briere1simplified_1999",
              "tomlinsonphillips_2015",
              'lactin2_1995'
            ),
            "temp",
            "rate",
            iter = list(150, 150, c(4, 4, 4), 150, 200),
            lhstype = 'random'
          )
        }
      ),
      .progress = TRUE
    )
  ) %>%
  tidyr::unnest(mods)

# close parallel session
daemons(0)

# end time of parallel
parallel_end <- Sys.time()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions