How do I use a local `golem` package with `future()`?

259 Views Asked by At

TL;DR

How do I reference/use a local package function from the shiny app that I am running, when it is not in my win-library?

ERROR:

Warning: Error in : there is no package called 'humblFinance'

PSEUDO-CODE:

 output$p1 <- renderPlot({

            future::future({
            out   <- myPackage::collect_price(symbol = input$tickerInput,
                                                 range = "1m")
            input <- input
                out   <- out %>%
                    ggplot2::ggplot(ggplot2::aes(x = date, y = fclose)) +
                    ggplot2::geom_line(size = 1) +
                    ggplot2::labs(title = glue::glue("{input$tickerInput} Price Chart"), y = "Closing Price", x = "")
                return(out)
            }) %...>% (
                function(result){ return(result) }
            ) %...!% (
                function(error){ warning(error) }
            )
        })

I am getting the error below when trying to use a function mypackage::myfun() in a future({}) statement. my shinyApp is creating with the golem and brochure infrastructure, so I am not sure where to reference this package? I have tried installing the package within the statement but doesn't seem to work. Should I point the future call to the tarball in the project root directory?

  1. loadNamespace() didnt work
  2. attatchNamespace() didnt work
  3. remotes::install_local() didnt work
1

There are 1 best solutions below

0
On

Have you tried the answer in this post:

I get an error when using {future} and {furrr} functions within a Golem Shiny App, what does it come from?

This solution hasn't worked for me but seems to have worked for the author of the post