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

Add release post for webR 0.3.1 #689

Merged
merged 7 commits into from
Apr 2, 2024
Merged

Add release post for webR 0.3.1 #689

merged 7 commits into from
Apr 2, 2024

Conversation

georgestagg
Copy link
Member

@georgestagg georgestagg commented Mar 20, 2024

To be posted after webR 0.3.0 hits npm and CDN.

  • Indended to expand on some of the items in webR's NEWS.md file. The post is perhaps a little heavy on details aimed at JavaScript developers, but hopefully still interesting to the general audience.

  • Some of the example output is hard-coded in the source, rather than generated by knitr, e.g. JS output and errors. There is some custom styling near the start of the post to tweak the visuals for this.

  • Includes updates to the version of webR itself shipped on the website - used for interactive examples.


Updated links to hotfix 0.3.1 release.

@georgestagg georgestagg changed the title Add release post for webR 0.3.0 Add release post for webR 0.3.1 Mar 25, 2024
Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is so great to see webR become mature software 😄


<div class="output error">

Uncaught Error: Error in sin("abc"): non-numeric argument to mathematical function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the post and not terribly important but could the call be backticked? Less consistent with base R but to be perfectly consistent we'd need a space between the call and semi-colon, I think it's better to follow the tidyverse style here.

Copy link
Member Author

@georgestagg georgestagg Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I don't think we need it to be entirely consistent with base R and I like the idea of using tidyverse style with backticks. I've made an issue to track this: r-wasm/webr#397 for next patch release.


### R `data.frame`

JavaScript objects of shape `{ x: [...], y: [...] }`, with data in a "long" column-based form, can now be used to construct R objects. In previous versions of webR, this object shape was reserved for future use. However, with this release webR now constructs an R `data.frame` by taking the source object's properties as column vectors. The resulting `data.frame` can then be manipulated from R in the usual way:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about it the more I feel this would be better done with a helper ctor that would support both shapes of data frames and would check for data frame invariants on the JS side. Especially since this ctor downgrades to lists silently. It seems to me that the ease of use of this syntax is not worth the very real downsides on programming errors. We are compounding silent coercions and laziness of checking (if any) here.

If this is just for debugging then this should probably not be documented prominently. But also I feel like a short-name ctor would be just as good for interactivity.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in another forum, we'll keep this as-is for now, but address the issues in the next minor release of webR with the aim of stabilising the mapping between JS object shape and R object type.

My current plan is the following changes:

  1. Reserve this JS syntax for constructing only data.frames when using the generic RObject() constructor.
  2. Remove the list fallback and throw an Error instead. R lists can still be constructed using e.g. RList().
  3. Add a small RList subclass, RDataFrame, for explicit data.frame construction.
  4. Document the above, recommending for production code to use the explicit constructors rather than RObject.

We'll continue this discussion in a future PR on the webR repo.

@georgestagg
Copy link
Member Author

Thanks again for the proof read and review!

@georgestagg georgestagg merged commit 047ba0e into main Apr 2, 2024
4 checks passed
@georgestagg georgestagg deleted the webr-0-3-0 branch April 2, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants