r-wasm / webr

The statistical language R compiled to WebAssembly via Emscripten, for use in web browsers and Node.
https://docs.r-wasm.org/webr/latest/
Other
885 stars 70 forks source link

How to compile webr with the needed packages #393

Open isbool opened 8 months ago

isbool commented 8 months ago

Hey, I saw this

WebR packages must be installed before use, which in practice means copying binaries into the webR virtual filesystem in some way, either as part of the webR build process or during runtime by downloading packages from a repository or mounting filesystem data.

I wanted to ask if its possible / or how to compile maybe webr with the libraries, to improve performance in the sense that they wont have to get mounted or loaded each time.

Lets say that in my app in / public i have a /r-scripts directory and a /libraries directory (that has folders of extracted packages)

i tried making a .data and .js file with file_packer but i cant seem to connect it successfully , would it be possible for you to give us an example of mounting .R scripts and libraries?

Also i wanted to ask if its possible that you could create a discord server or a slack server of the people involved here.

thanks for your time

georgestagg commented 8 months ago

I wanted to ask if its possible / or how to compile maybe webr with the libraries.

Yes, if you compile webR from source you can either place extracted webR binary packages in the source directory packages, or set the environment variable WEBR_LIB to point to a directory containing extracted binary packages. In either case the packages should be bundled in the resulting default virtual filesystem and available by default.

I tried making a .data and .js file with file_packer but i cant seem to connect it successfully

Please try working through the documentation here: https://r-wasm.github.io/rwasm/articles/mount-fs-image.html Let me know if you're unable to make the specific instructions at that URL work, and I'll take a closer look at any issues you come across.

Also i wanted to ask if its possible that you could create a discord server or a slack server of the people involved here.

I'm not entirely sure about an external service such as Discord or Slack. Such things often require a significant effort in maintenance and administration. Currently the best place to ask questions is GitHub Issues, but as the webR community grows and discussion expands I might enable the Discussions tab in GitHub for this repo, with the caveat that it will be monitored less than the Issues section.