Displaying 12 results from an estimated 12 matches for "vec_c".
Did you mean:
vec_a
2018 Aug 06
2
vctrs: a type system for the tidyverse
...eful to get
comments from a wide audience, so I?m reaching out to R-devel to get
your thoughts.
There is quite a lot already in the readme
(<https://github.com/r-lib/vctrs#vctrs>), so here I?ll try to motivate
vctrs as succinctly as possible by comparing `base::c()` to its
equivalent `vctrs::vec_c()`. I think the drawbacks of `c()` are well
known, but to refresh your memory, I?ve highlighted a few at
<https://github.com/r-lib/vctrs#compared-to-base-r>. I think they arise
because of two main challenges: `c()` has to both combine vectors *and*
strip attributes, and it only dispatches on...
2018 Aug 06
0
vctrs: a type system for the tidyverse
...ide audience, so I?m reaching out to R-devel to get
> your thoughts.
>
> There is quite a lot already in the readme
> (<https://github.com/r-lib/vctrs#vctrs>), so here I?ll try to motivate
> vctrs as succinctly as possible by comparing `base::c()` to its
> equivalent `vctrs::vec_c()`. I think the drawbacks of `c()` are well
> known, but to refresh your memory, I?ve highlighted a few at
> <https://github.com/r-lib/vctrs#compared-to-base-r>. I think they arise
> because of two main challenges: `c()` has to both combine vectors *and*
> strip attributes, and it...
2018 Aug 06
3
vctrs: a type system for the tidyverse
...ching out to R-devel to get
>> your thoughts.
>>
>> There is quite a lot already in the readme
>> (<https://github.com/r-lib/vctrs#vctrs>), so here I?ll try to motivate
>> vctrs as succinctly as possible by comparing `base::c()` to its
>> equivalent `vctrs::vec_c()`. I think the drawbacks of `c()` are well
>> known, but to refresh your memory, I?ve highlighted a few at
>> <https://github.com/r-lib/vctrs#compared-to-base-r>. I think they arise
>> because of two main challenges: `c()` has to both combine vectors *and*
>> strip at...
2018 Aug 09
2
vctrs: a type system for the tidyverse
...y it refers to a set of rules (either statically enforced
> by the compiler or dynamically enforced by the runtime) that ensure
> that some particular category of errors can be caught by the
> language.
>
> There is none of that here.
I think there's a bit of that flavour here:
vec_c(factor("a"), Sys.Date())
#> Error: No common type for factor and date
This isn't a type system imposed by the language, but I don't think
that's a reason not to call it a type system.
That said, I agree that calling it a type system is currently
overselling it, and I have...
2018 Aug 08
4
vctrs: a type system for the tidyverse
>>>>> Hadley Wickham
>>>>> on Wed, 8 Aug 2018 09:34:42 -0500 writes:
>>>> Method dispatch for `vec_c()` is quite simple because
>>>> associativity and commutativity mean that we can
>>>> determine the output type only by considering a pair of
>>>> inputs at a time. To this end, vctrs provides
>>>> `vec_type2()` which takes two inputs...
2018 Aug 08
0
vctrs: a type system for the tidyverse
...classes
(and indeed it's implemented using S3), the coercion/casting
relationship do not strictly follow the subclass/superclass
relationships.
A good motivating example is now ordered vs factor - I don't think you
can say that ordered or factor have greater resolution than the other
so:
vec_c(factor("a"), ordered("a"))
#> Error: No common type for factor and ordered
This is not what you'd expect from an _object_ system since ordered is
a subclass of factor.
Hadley
--
http://hadley.nz
2018 Aug 08
0
vctrs: a type system for the tidyverse
>>> Method dispatch for `vec_c()` is quite simple because associativity and
>>> commutativity mean that we can determine the output type only by
>>> considering a pair of inputs at a time. To this end, vctrs provides
>>> `vec_type2()` which takes two inputs and returns their common type
>>> (r...
2018 Aug 08
0
vctrs: a type system for the tidyverse
...tion, in
practice, does that.
Best,
~G
On Wed, Aug 8, 2018 at 8:54 AM, Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> >>>>> Hadley Wickham
> >>>>> on Wed, 8 Aug 2018 09:34:42 -0500 writes:
>
> >>>> Method dispatch for `vec_c()` is quite simple because
> >>>> associativity and commutativity mean that we can
> >>>> determine the output type only by considering a pair of
> >>>> inputs at a time. To this end, vctrs provides
> >>>> `vec_type2()` whi...
2018 Aug 09
2
vctrs: a type system for the tidyverse
> > As Gabe mentioned (and you've explained about) the term "type"
> > is really confusing here. As you know, the R internals are all
> > about SEXPs, TYPEOF(), etc, and that's what the R level
> > typeof(.) also returns. As you want to use something slightly
> > different, it should be different naming, ideally something not
> > existing yet
2018 Aug 08
2
vctrs: a type system for the tidyverse
Hadley,
Responses inline.
On Wed, Aug 8, 2018 at 7:34 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
> >>> Method dispatch for `vec_c()` is quite simple because associativity and
> >>> commutativity mean that we can determine the output type only by
> >>> considering a pair of inputs at a time. To this end, vctrs provides
> >>> `vec_type2()` which takes two inputs and returns their common type...
2018 Nov 06
0
An update on the vctrs package
...-stable functions makes code
easier to reason about and hence more likely to be bug free.
You can read more about size- and type-stability at
<https://vctrs.r-lib.org/articles/stability.html>. This vignette
includes a detailed analysis of `c()` and a type- and size-stable
alternative called `vec_c()`.
## New vector types
Finally, vctrs provides `new_vctr()` and `new_rcrd()` to make it easier
to define new classes, following the conventions that I?ve found
helpful, including writing a constructor function that enforces the
types of the underlying vector and its attributes (more details at
&...
2018 Aug 08
2
vctrs: a type system for the tidyverse
...G
>
> On Wed, Aug 8, 2018 at 8:54 AM, Martin Maechler <maechler at stat.math.ethz.ch>
> wrote:
>
> > >>>>> Hadley Wickham
> > >>>>> on Wed, 8 Aug 2018 09:34:42 -0500 writes:
> >
> > >>>> Method dispatch for `vec_c()` is quite simple because
> > >>>> associativity and commutativity mean that we can
> > >>>> determine the output type only by considering a pair of
> > >>>> inputs at a time. To this end, vctrs provides
> > >>>&g...