-
-
Notifications
You must be signed in to change notification settings - Fork 24
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 Request: Support for units
objects in rvar
data type
#385
Comments
Thank you for opening this issue! @mjskay since you are the developer of |
Hmm, in principle it seems like it should be possible to support other backing datatypes so long as they implement the necessary array operations. If we're going down that road I'd want to think about how to do it in a general enough way that we don't have to explicitly support every array-like datatype under the sun, but instead base it on some consistent extension points. Part of the problem is that several rvar methods currently use specialized functions under the hood for performance reasons but which only (I think?) work on numeric vectors (e.g. However, I would not want to do this using multiple dispatch as implemented in {vctrs}, because it is (frankly) a giant hack that will require a lot of boilerplate code (and may not even be doable...). Instead, I think the right solution would be to build it on top of S7. I'm not sure if S7 is quite mature enough yet for some of the things we want to do, but it's close. I have been playing with building parameterized types on top of S7 in another project and it can work pretty well (and I think they may also add some kind of official support for it). The main thing will be making sure we can retain compatibility with {vctrs}, though I assume they will make vctrs S7-compatible at some point since several of the same folks are involved in each. |
Thank you for your thoughts! In this light, I would say we may want to revisit this issue later on once S7 is more stable. Even then, it may not necessarily be a good idea to go this route, since (I assume) it would make the |
@paul-buerkner an excellent point. Perhaps we should make maintainability a criterion of any large overhaul? I think we could do a shift to S7 where the goal is to make rvar more maintainable, keeping feature parity. Having played with S7 quite a bit now, I think it will be much easier to read and write than vctrs. Then, if the shift to S7 works out, we could consider new features, like supporting other backing data types. |
I think that sounds like a great plan!
Matthew Kay ***@***.***> schrieb am Mi., 18. Dez. 2024, 18:32:
… @paul-buerkner <https://github.com/paul-buerkner> an excellent point.
Perhaps we should make maintainability a criterion of any large overhaul?
I think we could do a shift to S7 where the goal is to make rvar more
maintainable, keeping feature parity. Having played with S7 quite a bit
now, I think it will be much easier to read and write than vctrs. Then, if
the shift to S7 works out, we could consider new features, like supporting
other backing data types.
—
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADCW2ACGDKKZONTWEMJN6UT2GGWRDAVCNFSM6AAAAABTLKN55OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJRHEYDEMZSGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I also think this is a reasonable plan. Thank you all for discussing my issue so quickly! |
I often use the units package to keep track of measurement units and I think it may be interesting to support
units
objects with thervar
class. I wanted to know whether there is interest to include this feature into theposterior
package.Currently, it is possible to create
rvar
objects where thedraws
attribute is aunits
object:Created on 2024-12-10 with reprex v2.0.2
And simple arithmetic operations work:
But some operations drop the
units
class. For example:I only did a couple of quick tests, so I have no complete overview, which operations are supported and which are not supported. I can also imagine that adapting some functions may be more difficult.
The text was updated successfully, but these errors were encountered: