[Rd] R 4.0.2 is released
The build system rolled up R-4.0.2.tar.gz (codename "Taking Off Again") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-4/R-4.0.2.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team, Peter Dalgaard These are the checksums (md5 and SHA-256) for the freshly created files, in case you wish to check that they are uncorrupted: MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4 MD5 (COPYING) = eb723b61539feef013de476e68b5c50a MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343 MD5 (FAQ) = 4afa171cd982aaa60f0ba92e2e7bc5d6 MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b MD5 (NEWS) = 566a6bb3642e28e6bf01cf98db31137c MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8 MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801 MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6 MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8 MD5 (R-latest.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e MD5 (README) = f468f281c919665e276a1b691decbbe6 MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435 MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6 MD5 (VERSION-INFO.dcf) = 62496d3a0fd8cc2ed644ea518c052371 MD5 (R-4/R-4.0.2.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e 2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09 AUTHORS e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4 COPYING 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 COPYING.LIB eddf87b12197c7b3b19cbc9b11c1beab95b14e3dcd715bf37d2f6a8b2a72c2a1 FAQ f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31 INSTALL ec05bba338358410fae6b34fed061605989ab3601aba1b3fcb45a610d5dd2eb9 NEWS 4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62 NEWS.0 12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01 NEWS.1 e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e NEWS.2 7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0 NEWS.3 d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75 R-latest.tar.gz 2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc README 408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9 RESOURCES c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73 THANKS 10cc5f566a4a5ce49147e7dcfbe9180dba09ccb9efb17298b067309eb799e92e VERSION-INFO.dcf d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75 R-4/R-4.0.2.tar.gz This is the relevant part of the NEWS file CHANGES IN R 4.0.2: UTILITIES: * R CMD check skips vignette re-building (with a warning) if the VignetteBuilder package(s) are not available. BUG FIXES: * Paths with non-ASCII characters caused problems for package loading on Windows PR#17833. * Using tcltk widgets no longer crashes R on Windows. * source(*, echo=TRUE) no longer fails in some cases with empty lines; reported by Bill Dunlap in PR#17769. * on.exit() now correctly matches named arguments, thanks to PR#17815 (including patch) by Brodie Gaslam. * regexpr(*, perl=TRUE) no longer returns incorrect positions into text containing characters outside of the Unicode Basic Multilingual Plane on Windows. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Possible Bug: file.exists() Function. Due to UTF-8 Encoding differences on Windows between R 4.0.1 and R 3.6.3?
Hi Yihui, list.files() returns file names converted to native encoding by Windows, so one needs to use only characters representable in current native encoding for file names. If one wants to be safe, it makes sense to be much stricter than that (only ASCII, and only a subset of it, there is a number of recommendations that can be found online). Using more than that is asking for trouble. Unicode "\u00e4" is a Latin-1 character, so representable in CP1252. On my Windows running in CP1252 as C locale and system code page, your example works fine, file.exists() returns TRUE, and this is the expected behavior (tested in R-devel and R4.0). Your example was run in CP1252 as C locale but CP936 as the system code page (see the sessionInfo() output). On Windows, unfortunately, there are two different "current locales" at a time. With your settings (CP1252 as C locale and CP936 as system code page), I get the same results as you, file.exists() returns FALSE. enc2native(z) works fine and returns a valid Latin-1 string, but that is because here "native" is CP1252. Windows API functions and consequently some C library functions that return strings from the OS, however, convert to the encoding from the system code page, which is CP936 and it cannot represent "รค". So, currently the behavior you are reporting is expected for R 4.0 and earlier. I don't think this is a regression, it couldn't have worked before, either - and I've tested in 3.6.3 and 3.4.3 on my system. These problems will go away when UTF-8 is both the current native encoding for the C locale and the system code page. This is possible in recent Windows 10, but requires UCRT and hence a new toolchain to build R, and requires all packages and libraries to be rebuilt from source. More details on my blog, also there is experimental build of R (installer) and experimental toolchain available: https://developer.r-project.org/Blog/public/2020/05/02/utf-8-support-on-windows/index.html Best Tomas On 6/22/20 6:11 AM, Yihui Xie wrote: Hi Tomas, I received a report about R 4.0.0 in the knitr package (https://github.com/yihui/knitr/issues/1840), and I think it is related to the issue here. I created a minimal reproducible example below: owd = setwd(tempdir()) z = 'K\u00e4sch.txt' file.create(z) list.files() file.exists(list.files()) setwd(owd) Output: owd = setwd(tempdir()) z = 'K\u00e4sch.txt' file.create(z) [1] TRUE list.files() [1] "K?sch.txt" file.exists(list.files()) [1] FALSE setwd(owd) I wonder if it is expected that file.exists() returns FALSE here. sessionInfo() R version 4.0.1 (2020-06-06) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 system code page: 936 FWIW, I also tested Chinese characters in the variable `z` above, and file.exists() returns TRUE only after I Sys.setlocale(, "Chinese"). Regards, Yihui On Thu, Jun 11, 2020 at 3:11 AM Tomas Kalibera wrote: Dear Juan, I don't see what is the problem from your report. Please try to create a minimal but complete reproducible example that does not use the renv package. Perhaps you could use the R debugger (e.g. via options(error=recover)) to find out what is the argument that file.exists() has been called with. And then you could try just to call file.exists() directly with that argument to trigger the problem. It may be that the argument has been corrupted/is invalid in the current native encoding. If that is the case, the next step would be to find out who corrupted it (renv, R, something else). The error is displayed when a path name cannot be converted from the current native encoding to UTF16-LE. The experimental support for UTF-8 as native encoding on Windows 10 is only available in a custom build of R, like the one I linked from my blog post. Thanks Tomas On 6/10/20 1:06 PM, Juan Telleria Ruiz de Aguirre wrote: Dear R Developers, I am having an issue with the renv package and R 4.0.1, which I suspect is related to base R and not the renv package itself, as with R 3.6.3 such an "error" does not appear. The error is raised by a file.exists() path, and path "C:\Users\J-tel\Documents", which in R 3.6.3 is read correctly, but in R 4.0.1 fails (Probably because of the "-" symbol), and I suspect it might be related with the new UTF-8 usage on Windows 10? (https://developer.r-project.org/Blog/public/2020/05/02/utf-8-support-on-windows/index.html) I have also checked file.exists() function and its internals, and seem not to have happened changes in the meanwhile within them: https://github.com/wch/r-source/blob/0e3b3182f87a60af4b0293a5410dde680b910f49/src/library/base/R/files.R https://github.com/search?q=SEXP%20attribute_hidden%20do_fileexists+repo:wch/r-source&type=Code Error Details: renv::init() Error in
[Rd] mget(missingArgument)?
Currently, when mget() is used to get the value of a function's argument with no default value and no value in the call it returns the empty name (R_MissingArg). Is that the right thing to do or should it return 'ifnotfound' or give an error? E.g., > a <- (function(x) { y <- "y from function's environment"; mget(c("x","y","z"), envir=environment(), ifnotfound=666)})() > str(a) List of 3 $ x: symbol $ y: chr "y from function's environment" $ z: num 666 The similar function get0() gives an error in that case. > b <- (function(x) get0("x", envir=environment(), ifnotfound=666))() Error in get0("x", envir = environment(), ifnotfound = 666) : argument "x" is missing, with no default Bill Dunlap TIBCO Software wdunlap tibco.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] mget(missingArgument)?
At first I thought this was more or less correct, because > f = function(x) { y <- mget("x")[[1]]; missing(y)} > f() [1] TRUE reflects the actual "value" of x, but then at the very least this > f = function(x) { y <- mget("x")[[1]]; y} > f() *Error in f() : argument "y" is missing, with no default* Is a problem because, of course, y was not an argument of f and talking about its default is nonsensical, and the actual argument which was missing is not named. ~G On Mon, Jun 22, 2020 at 5:06 PM William Dunlap via R-devel < r-devel@r-project.org> wrote: > Currently, when mget() is used to get the value of a function's argument > with no default value and no value in the call it returns the empty name > (R_MissingArg). Is that the right thing to do or should it return > 'ifnotfound' or give an error? > > E.g., > > a <- (function(x) { y <- "y from function's environment"; > mget(c("x","y","z"), envir=environment(), ifnotfound=666)})() > > str(a) > List of 3 > $ x: symbol > $ y: chr "y from function's environment" > $ z: num 666 > > The similar function get0() gives an error in that case. > > b <- (function(x) get0("x", envir=environment(), ifnotfound=666))() > Error in get0("x", envir = environment(), ifnotfound = 666) : > argument "x" is missing, with no default > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel