[Rd] stringsAsFactors and type.convert()

2020-04-13 Thread Arni Magnusson
If read.table() is defaulting to "character" instead of "factor" data type, shouldn't type.convert() also default to "character" in R 4.0.0? This would seem like a good time to change the default to type.convert(as.is=TRUE), to align it with the new default in read.table and data.frame. I think

Re: [Rd] stringsAsFactors

2020-04-13 Thread Henrik Bengtsson
While at it, would it be worth mentioning in the NEWS for R 4.0.0 that options 'stringsAsFactors' is being deprecated, e.g. $ options(stringsAsFactors = TRUE) Warning message: In options(stringsAsFactors = TRUE) : 'options(stringsAsFactors = TRUE)' is deprecated and will be disabled ? Currentl

Re: [Rd] detect ->

2020-04-13 Thread William Dunlap via R-devel
Using => and <= instead of -> and <- would make things easier, although the precedence would be different. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Apr 13, 2020 at 1:43 AM Adrian Dușa wrote: > Thank you for your replies, this actually has little to do with the > regular R code but

Re: [Rd] stringsAsFactors

2020-04-13 Thread Martin Maechler
> Hugh Parsonage > on Mon, 13 Apr 2020 21:20:26 +1000 writes: > Further, in addition to the `val <- FALSE` patch a few hours ago by > Martin, the line after should also be changed > - if(!is.logical(val) || is.na(val) || length(val) != 1L) > + if(!is.logical(val) || l

[Rd] Poor family objects error messages

2020-04-13 Thread GILLIBERT, Andre
Hello, The following code: > binomial(identity) Generates an error message: Error in binomial(identity) : link "identity" not available for binomial family; available links are �logit�, �probit�, �cloglog�, �cauchit�, �log� While : > binomial("identity") Yields an identity-binomial object th

Re: [Rd] stringsAsFactors

2020-04-13 Thread peter dalgaard
In both cases, that is as it should be. 1. expand.grid() (sic) has its main application in factorial designs, for which you want a set of factors 2. tables are factorial structures by nature. Converting factors to character would lose level order (true for 1. as well, actually) - pd > On 13

Re: [Rd] stringsAsFactors

2020-04-13 Thread Hugh Parsonage
Further, in addition to the `val <- FALSE` patch a few hours ago by Martin, the line after should also be changed - if(!is.logical(val) || is.na(val) || length(val) != 1L) + if(!is.logical(val) || length(val) != 1L || is.na(val)) ## Consider Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "TRUE") option

Re: [Rd] stringsAsFactors

2020-04-13 Thread Karolis Koncevičius
Hello, I also want to report 2 missed cases of stringsAsFactors=TRUE in base: 1. grid.expand() still uses hard stringsAsFactors=TRUE in its arguments. 2. as.data.frame.table() also keeps factors after conversion from table. Duncan Murdoch on Sun, 12 Apr 2020 08:57:14 -0400 writes: > T

Re: [Rd] Long model specification causes aov() to abort with error

2020-04-13 Thread Martin Maechler
> Jan Hauffa > on Sat, 11 Apr 2020 15:51:49 +0200 writes: > Dear R developers, > while experimenting with repeated measures ANOVA, I found out that it is > possible to construct a model specification that is syntactically valid, > but causes aov() to abort with an er

Re: [Rd] detect ->

2020-04-13 Thread Adrian Dușa
Thank you for your replies, this actually has little to do with the regular R code but more to signal what in my package QCA is referred to as a necessity relation A <- B (A is necessary for B) and sufficiency A -> B (A is sufficient for B). If switched by the parser, A -> B becomes B <- A whic

Re: [Rd] detect ->

2020-04-13 Thread Gábor Csárdi
On Mon, Apr 13, 2020 at 9:23 AM Gabriel Becker wrote: [...] > This means the only feasible way to detect it, which a few projects do I > believe, is process the code while it is still raw text, before it goes into > the parser, and have clever enough regular expressions. Well, especially consid

Re: [Rd] detect ->

2020-04-13 Thread Gabriel Becker
Adrian, Indeed, this has come up in a few places, but as Gabor says, there is no such thing as right hand assignment at any point after parsing is complete. This means the only feasible way to detect it, which a few projects do I believe, is process the code while it is still raw text, before it

Re: [Rd] stringsAsFactors

2020-04-13 Thread Martin Maechler
> Duncan Murdoch > on Sun, 12 Apr 2020 08:57:14 -0400 writes: > The NEWS for R 4.0.0 says "R now uses a stringsAsFactors = FALSE > default, and hence by default no longer converts strings to factors in > calls to data.frame() and read.table()." > This seems to have

Re: [Rd] detect ->

2020-04-13 Thread Gábor Csárdi
That parser already flips -> to <- before creating the parse tree. Gabor On Mon, Apr 13, 2020 at 8:39 AM Adrian Dușa wrote: > > I searched and tried for hours, to no avail although it looks simple. > > (function(x) substitute(x))(A <- B) > #A <- B > > (function(x) substitute(x))(A -> B) > # B <-

[Rd] detect ->

2020-04-13 Thread Adrian Dușa
I searched and tried for hours, to no avail although it looks simple. (function(x) substitute(x))(A <- B) #A <- B (function(x) substitute(x))(A -> B) # B <- A In the first example, A occurs on the LHS, but in the second example A is somehow evaluated as if it occured on the RHS, despite my unde