You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many times I would like to use a class_string() or class_float() which would be a character and double scalar respectively. I think this is a very common use case.
Right now, we can use the rlang standalone type checks for making custom validators, but it would be exceptionally nice if these basic and common use cases were made available in S7.
If this is something that the maintainers of S7 would support, I would be happy to make a PR.
@lawremi yes! Having a scalar property would be amazing. If there was one for the basic vector types—e.g. double, int, logical, factor, that would be beautiful
second this as well - dealing with scalars and their validation logic i tend to repeat in every project using S7 (and R in general) but it seems like an area better suited for being baked into S7 itself. Enums are another common pattern as well but that's higher level than just a scalar vs. non-scalar.
Activity
lawremi commentedon Jul 24, 2025
Are you referring to something like #433 ?
JosiahParry commentedon Jul 24, 2025
@lawremi yes! Having a scalar property would be amazing. If there was one for the basic vector types—e.g. double, int, logical, factor, that would be beautiful
lawremi commentedon Jul 24, 2025
Agreed, closing in deference to #433.
JosiahParry commentedon Jul 24, 2025
I personally think the scope of #433 is more broad than this issue
JosiahParry commentedon Jul 24, 2025
I'd also note that #433 is a PR and not an issue. It may be good to have an issue to track instead of the PR?
[-]scalar default classes[/-][+]scalar properties[/+]lawremi commentedon Jul 24, 2025
Ok, I will re-open, with a slight clarification of the issue name to make it easier to find.
selkamand commentedon Jan 12, 2026
Just seconding this feature request 😁! Scalar classes would be very convenient
jimbrig commentedon Oct 2, 2026
second this as well - dealing with scalars and their validation logic i tend to repeat in every project using S7 (and R in general) but it seems like an area better suited for being baked into S7 itself. Enums are another common pattern as well but that's higher level than just a scalar vs. non-scalar.