An update on the vctrs package
Kia Ora
vec_size(data.frame(x = 1:10)) #> [1] 10 vec_size(array(dim = c(10, 4, 1))) #> [1] 10
I think that "length" (in the R way) or "size" should incorporate the number of columns (or other dimension information). How about:
vec_npoints (x) vec_nrecords (x) vec_nobs (x)
Depending on whether you want to promote geometry, databases or statistics. I like npoints because I like to be Geometry-Friendly :). This next issue isn't probably the feedback you're looking for. However, given that you brought it up...
vec_size(mean) #> Error: `x` is a not a vector
This is very interesting. I'm writing a function where I'm planning to do the complete opposite. I could return the number of lines of a function or the number of it's arguments. However, it would be nice to do something like.
object.size (mean)
f: Nn -> N1 (Note that I'm using "N" for numeric rather than the more obvious "R" for real). It's difficult for an R function to determine the input types of another R function and even more difficult to determine the output types. It may be possible to incorporate a comment as a variable (inside a function) rather than a comment as a comment.
mymean = function (x)
+ { #info
+ .map = "f: Nn -> N1"
+
+ mean (x)
+ }
kind regards
Abs