r-lib / vctrs

Generic programming with typed R vectors
https://vctrs.r-lib.org
Other
287 stars 66 forks source link

Declare S3 atomic vectors as scalars #679

Open lionel- opened 4 years ago

lionel- commented 4 years ago

Options:

  1. Resurrect vec_is_vector() generic.
  2. Inherit from a fake base class, e.g. "vctrs_scalar".
  3. Return some kind of sentinel from vec_proxy()

I'm leaning towards 3

lionel- commented 4 years ago

Returning NULL from vec_proxy() to declare a scalar seems to make most sense. Then we could frame vec_proxy.default() as returning NULL for S3 lists.

lionel- commented 4 years ago

sf geometries are examples of atomic vectors that should be treated as scalars by vctrs.