Skip to content

scalar properties #554

Open
Open

Description

@JosiahParry

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.

Related-ish issue: #412

Edit 2026-10-02: I've build {s7x} to fill this gap in the meantime.

Activity

  1. lawremi commented on Jul 24, 2025

    @lawremi
    Collaborator

    Are you referring to something like #433 ?

  2. JosiahParry commented on Jul 24, 2025

    @JosiahParry
    Author

    @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

  3. lawremi commented on Jul 24, 2025

    @lawremi
    Collaborator

    Agreed, closing in deference to #433.

  4. JosiahParry commented on Jul 24, 2025

    @JosiahParry
    Author

    I personally think the scope of #433 is more broad than this issue

  5. JosiahParry commented on Jul 24, 2025

    @JosiahParry
    Author

    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?

  6. changed the title [-]scalar default classes[/-] [+]scalar properties[/+] on Jul 24, 2025
  7. lawremi commented on Jul 24, 2025

    @lawremi
    Collaborator

    Ok, I will re-open, with a slight clarification of the issue name to make it easier to find.

  8. selkamand commented on Jan 12, 2026

    @selkamand

    Just seconding this feature request 😁! Scalar classes would be very convenient

  9. added
    feature
    on May 21, 2026
  10. jimbrig commented on Oct 2, 2026

    @jimbrig

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions