Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Joris Meys
I sent this to Iñaki personally by mistake. Thank you for notifying me. On Wed, Aug 8, 2018 at 7:53 PM Iñaki Úcar wrote: > > For what it's worth, I always thought about factors as fundamentally > characters, but with restrictions: a subspace of all possible strings. > And I'd say that a non-ne

[Rd] Bug in POSIXct string representation?

2018-08-09 Thread Festl, Andreas
Dear all, I just have identified the following issue which I believe could be a bug in R: Let me illustrate: First, enable the display of fractional seconds and check that it works: > options(digits.secs = 6, digits = 6) > as.character(as.POSIXct("2018-08-31 14:15:16.123456")) [1] "2018-08-31 14

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Hadley Wickham
On Thu, Aug 9, 2018 at 3:57 AM Joris Meys wrote: > > I sent this to Iñaki personally by mistake. Thank you for notifying me. > > On Wed, Aug 8, 2018 at 7:53 PM Iñaki Úcar wrote: > > > > > For what it's worth, I always thought about factors as fundamentally > > characters, but with restrictions:

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Dirk Eddelbuettel
On 8 August 2018 at 12:40, Hadley Wickham wrote: | I think this is true in the tidyverse, which will never give you a | factor unless you explicitly ask for one, but the default in base R | (at least as soon as a data frame is involved) is to turn character | vectors into factors. False. Base R

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Joris Meys
Hi Hadley, my point actually came from a data analyst point of view. A character variable is something used for extra information, eg the "any other ideas?" field of a questionnaire. A categorical variable is a variable describing categories defined by the researcher. If it is made clear that a fa

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Hadley Wickham
On Thu, Aug 9, 2018 at 7:54 AM Joris Meys wrote: > > Hi Hadley, > > my point actually came from a data analyst point of view. A character > variable is something used for extra information, eg the "any other ideas?" > field of a questionnaire. A categorical variable is a variable describing > c

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Hadley Wickham
> > 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

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread Tomas Kalibera
R's dyn.unload() will unconditionally unload the given shared object; it does not check whether there is any object (external pointer or weak reference) with a C finalizer pointing into the space of the shared object being unloaded. So it is expected that R will segfault later when such fina

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread Dirk Eddelbuettel
On 9 August 2018 at 20:37, Tomas Kalibera wrote: | So to answer your original question, this could probably be handled in | Rcpp, Hm. Why do you say that / what did you have in mind? Recall that we do not alter SEXPs or introduce additional additional reference counters -- because we do not th

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread Tomas Kalibera
On 9.8.2018 20:58, Dirk Eddelbuettel wrote: On 9 August 2018 at 20:37, Tomas Kalibera wrote: | So to answer your original question, this could probably be handled in | Rcpp, Hm. Why do you say that / what did you have in mind? Recall that we do not alter SEXPs or introduce additional additio

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread luke-tierney
On Thu, 9 Aug 2018, Dirk Eddelbuettel wrote: On 9 August 2018 at 20:37, Tomas Kalibera wrote: | So to answer your original question, this could probably be handled in | Rcpp, Hm. Why do you say that / what did you have in mind? We say it because it is true. Rcpp registers C finalizers and ru

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread Dirk Eddelbuettel
On 9 August 2018 at 14:13, luke-tier...@uiowa.edu wrote: | On Thu, 9 Aug 2018, Dirk Eddelbuettel wrote: | | > | > On 9 August 2018 at 20:37, Tomas Kalibera wrote: | > | So to answer your original question, this could probably be handled in | > | Rcpp, | > | > Hm. Why do you say that / what did y

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread jan Vitek via R-devel
> I'm now confident that I > can avoid using "type" by itself, and instead always use it in a > compound phrase (like type system) to avoid confusion. That leaves the > `.type` argument to many vctrs functions. I'm considering change it to > .prototype, because what you actually give it is a zero-l

[Rd] WishList: Remove Generic Arguments

2018-08-09 Thread Abs Spurdle
I apologize if this issue has been raised before. I really like object oriented S3 programming. However, there's one feature of object oriented S3 programming that I don't like. Generic functions can have arguments other than dots. Lets say you have an R package with something like: print.myfun

Re: [Rd] WishList: Remove Generic Arguments

2018-08-09 Thread Michael Lawrence
A generic function is not simply a way to name two functions (methods) the same. It has a particular purpose, and the argument names are aligned with and convey that purpose. The methods only implement polymorphism; they don't change the purpose. Changing the purpose would make code unreadable. Mi

Re: [Rd] WishList: Remove Generic Arguments

2018-08-09 Thread Duncan Murdoch
On 09/08/2018 5:45 PM, Abs Spurdle wrote: I apologize if this issue has been raised before. I really like object oriented S3 programming. However, there's one feature of object oriented S3 programming that I don't like. Generic functions can have arguments other than dots. Lets say you have a

Re: [Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp

2018-08-09 Thread Iñaki Úcar
Thanks, Tomas, Luke, for the clarifications. Then, I have another question. But first, let me introduce how I ended up here, because obviously I just don't go around dyn.unloading things that I've just compiled. I was testing a package with valgrind. Everything ok, no leaks. Great. But I'm always

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread Hadley Wickham
On Thu, Aug 9, 2018 at 4:26 PM jan Vitek wrote: > > > I'm now confident that I > > can avoid using "type" by itself, and instead always use it in a > > compound phrase (like type system) to avoid confusion. That leaves the > > `.type` argument to many vctrs functions. I'm considering change it to

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread luke-tierney
Some ideas from the 'numeric tower' notion in scheme/lisp might also be useful. Best, luke On Thu, 9 Aug 2018, Hadley Wickham wrote: On Thu, Aug 9, 2018 at 4:26 PM jan Vitek wrote: I'm now confident that I can avoid using "type" by itself, and instead always use it in a compound phrase (l

Re: [Rd] vctrs: a type system for the tidyverse

2018-08-09 Thread jan Vitek via R-devel
> > 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. All I am saying is that without a clear def