Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading packages not working #12

Open
jtr13 opened this issue Sep 25, 2024 · 4 comments
Open

Loading packages not working #12

jtr13 opened this issue Sep 25, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jtr13
Copy link

jtr13 commented Sep 25, 2024

First of all, thanks for a great extension!

This example isn't working for me:

format:
  revealjs:
    drop:
      engine: webr
      webr:
        packages:
          - ggplot2
          - dplyr

When I try to make a plot with ggplot2 I get:
Error in ggplot(mtcars, aes(wt, mpg)) : could not find function "ggplot"

@georgestagg
Copy link
Member

Hi, thanks for the kind words!

Does it work if you explicitly load the library with library(ggplot2) before calling the ggplot() command? It may be that the package is installed but not loaded automatically.

@jtr13
Copy link
Author

jtr13 commented Sep 26, 2024

Yes, that works. Perhaps I misunderstood that by including the packages in the YAML I wouldn't need to do that.

@georgestagg georgestagg added the enhancement New feature or request label Sep 26, 2024
@georgestagg
Copy link
Member

Sometimes it is useful to have a package that is installed, but not loaded with library(), which is why that is the default behaviour.

We can add an additional yaml configuration option to also load the package once it has finished installing.

@jtr13
Copy link
Author

jtr13 commented Sep 26, 2024

That would be a welcome addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants