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") options(stringsAsFactors = c(TRUE, FALSE)) default.stringsAsFactors() # correct error message On Mon, 13 Apr 2020 at 18:02, Martin Maechler <maechler at stat.math.ethz.ch> wrote:> > >>>>> 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 been implemented by setting options(stringsAsFactors > > = FALSE) in the main R profile. However, setting > > > options(stringsAsFactors = NULL) > > > reverts to the same behavior as the old options(stringsAsFactors > > TRUE). Is this intentional? > > > No! Thanks a lot for testing R 4.0.0 alpha/beta, noticing and > alerting us about it. > > This will be changed ASAP. > > ... and it will benefit the whole R user community if quite a > few good R users (as most readers of 'R-devel') would start > using 'R 4.0.0 beta' routinely now --- thanks a lot in advance! > > Martin > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>> 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) || length(val) != 1L || is.na(val)) > ## Consider > Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "TRUE") > options(stringsAsFactors = c(TRUE, FALSE)) In R-devel and R 4.0.0 alpha/beta, you have> options(stringsAsFactors = c(TRUE, FALSE))Error in options(stringsAsFactors = c(TRUE, FALSE)) : invalid value for 'stringsAsFactors' > default.stringsAsFactors() # correct error message Note that the default.stringsAsFactors() function is also deprecated, of course. Not "formally", in the sense that its use would give a deprecation warning {which would be *bad* as it's still used for the default argument e.g. of read.table()}, but the help page (in R-devel and R 4.0.0 "pre-release") has been saying for a while now 1) Usage: data.frame( ......... ) default.stringsAsFactors() # << this is deprecated ! ^^^^^^^^^^^^^^^^^^^^^^^^^^ and 2) in 'Details:' default.stringsAsFactors is a utility ............ ........... ............ This function is *deprecated* now and will no longer be available in the future. and so it'd be a waste to change it unnecessarily. Martin > On Mon, 13 Apr 2020 at 18:02, Martin Maechler > <maechler at stat.math.ethz.ch> wrote: >> >> >>>>> 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 been implemented by setting options(stringsAsFactors >> > = FALSE) in the main R profile. However, setting >> >> > options(stringsAsFactors = NULL) >> >> > reverts to the same behavior as the old options(stringsAsFactors >> > TRUE). Is this intentional? >> >> >> No! Thanks a lot for testing R 4.0.0 alpha/beta, noticing and >> alerting us about it. >> >> This will be changed ASAP. >> >> ... and it will benefit the whole R user community if quite a >> few good R users (as most readers of 'R-devel') would start >> using 'R 4.0.0 beta' routinely now --- thanks a lot in advance! >> >> Martin >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel
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 ? Currently, the news only 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(). /Henrik On Mon, Apr 13, 2020 at 5:23 AM Martin Maechler <maechler at stat.math.ethz.ch> wrote:> > >>>>> 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) || length(val) != 1L || is.na(val)) > > > ## Consider > > Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "TRUE") > > options(stringsAsFactors = c(TRUE, FALSE)) > > In R-devel and R 4.0.0 alpha/beta, you have > > > options(stringsAsFactors = c(TRUE, FALSE)) > Error in options(stringsAsFactors = c(TRUE, FALSE)) : > invalid value for 'stringsAsFactors' > > > > default.stringsAsFactors() # correct error message > > Note that the default.stringsAsFactors() function is also > deprecated, of course. Not "formally", in the sense that its > use would give a deprecation warning {which would be *bad* as > it's still used for the default argument e.g. of read.table()}, > but the help page (in R-devel and R 4.0.0 "pre-release") > has been saying for a while now > > 1) > > Usage: > > data.frame( ......... ) > > default.stringsAsFactors() # << this is deprecated ! > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > > and 2) in 'Details:' > > default.stringsAsFactors is a utility ............ > ........... ............ This function is *deprecated* now and will > no longer be available in the future. > > > and so it'd be a waste to change it unnecessarily. > Martin > > > On Mon, 13 Apr 2020 at 18:02, Martin Maechler > > <maechler at stat.math.ethz.ch> wrote: > >> > >> >>>>> 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 been implemented by setting options(stringsAsFactors > >> > = FALSE) in the main R profile. However, setting > >> > >> > options(stringsAsFactors = NULL) > >> > >> > reverts to the same behavior as the old options(stringsAsFactors > >> > TRUE). Is this intentional? > >> > >> > >> No! Thanks a lot for testing R 4.0.0 alpha/beta, noticing and > >> alerting us about it. > >> > >> This will be changed ASAP. > >> > >> ... and it will benefit the whole R user community if quite a > >> few good R users (as most readers of 'R-devel') would start > >> using 'R 4.0.0 beta' routinely now --- thanks a lot in advance! > >> > >> Martin > >> > >> ______________________________________________ > >> R-devel at r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-devel > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel