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

[Feature]: Reading data from a quarto webpage #221

Open
wetlandscapes opened this issue Aug 8, 2024 · 5 comments
Open

[Feature]: Reading data from a quarto webpage #221

wetlandscapes opened this issue Aug 8, 2024 · 5 comments
Labels
t: feature-request Request the addition of a new feature

Comments

@wetlandscapes
Copy link

Feature Description

First, thanks for all your hard work! This is an incredible package.

For reading and working with small amounts of data in webr, rather than referencing some external resource, could one potentially save the data of interest to a rendered quarto webpage with live cells and then use webr to access that data? In the context of quarto and knitr stuff, I think this would be data stored in a table attribute.

I'm not as familiar with this stuff as I should be, so I'm unclear if this would just mean adding some example code to qwebr-loading-data.qmd, as the functionality is already there (e.g., using {rvest}), or if this would require a lot of leg work in the context of webr, or even some javascript.

Just a thought!

@wetlandscapes wetlandscapes added the t: feature-request Request the addition of a new feature label Aug 8, 2024
@coatless
Copy link
Owner

coatless commented Aug 8, 2024

@wetlandscapes a copy and fetch mechanism is needed to ingest the data into VFS. The extension could incorporate it by parsing values under resources; but, this might make things more complicated.

@wetlandscapes
Copy link
Author

I appreciate that quick response. Given the complexity, maybe this is just something to keep in the back of our minds as time goes on.

As a work around (maybe that's not the right phrase), I did take a cursory stab at using {rvest} (which has a curl dependency, but the package still loaded), but it was very cursory and I wasn't able to immediately figure out how to point the live cell to the DOM. Maybe I'll find some time to dig into that later and if I do I'll report back. Happy to close the issue, or keep it open if you want the reminder.

@coatless
Copy link
Owner

coatless commented Aug 9, 2024

@wetlandscapes I thought about it a bit ago here:

#157 (comment)

But time to implement that portion was MIA.

The official WASM quarto backend that just dropped has resources support, c.f.

https://r-wasm.github.io/quarto-live/other/resources.html

https://github.com/r-wasm/quarto-live

@wetlandscapes
Copy link
Author

Fascinating! Thanks for pointing me to that project.

Just played around with the resources option of quarto-live extension and encountered two problems relative to what I was proposing (one of which I'll need to register with their repo), but the major issue is the same as you mentioned with using the VFS; using resources to load local data into the VFS is not persistent, while what I was proposing was to effectively ship data within the web page itself. This might be too much of an edge case to really matter, though, as most truly live websites should have access to data using the currently supported mechanisms. Just thought it would be neat to have this other option.

Thanks!

@coatless
Copy link
Owner

coatless commented Aug 9, 2024

For page embedding, maybe look at the ojs_define() usage to embed the data set.

https://r-wasm.github.io/quarto-live/interactive/hybrid.html#build-time-ojs-data-source

Otherwise, I think you want:

r-wasm/quarto-live#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: feature-request Request the addition of a new feature
Projects
None yet
Development

No branches or pull requests

2 participants