[Rd] Bug in RScript.exe for 3.5.0

2018-04-25 Thread Kerry Jackson
Hi R Developers,
I have found what I think is a bug in the RScript.exe in version 3.5.0 of R for 
Windows.
When I call Rscript.exe for Version 3.5 of R, it is unable to open the file if 
the file name or path has a space in it.
As an example of what happens, I saved 2 files with the code:
cat("What do you get when you multiply 6 * 9?")
as C:\foo bar.R and as C:\foo_bar.R
When I in a DOS command window try to run these using version 3.4.3 and 3.5:
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo bar.R"
Fatal error: cannot open file 'C:\foo': No such file or directory


C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>
When I try to run the file with a space in the name in version 3.5.0 of R, 
there is a fatal error saying there is no such file.


Kerry Jackson
Job title: Senior Account Manager, Ipsos Connect US RA Testing GMU
Phone: (203) 840-3443


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] extendrange(): suggested improvement

2018-04-25 Thread Marius Hofert
Hi,

I often need to extend the plot range to the right, but not to the
left (for example: not below 0 so that log = "x" still works...). This
could be a handy improvement of extendrange():

--- utils.R 2015-08-25 18:18:20.0 -0400
+++ utils.R 2018-04-25 17:21:25.0 -0400
@@ -30,6 +30,6 @@
 ## Purpose: extend a range by a factor 'f' - on each side
 if(!missing(r) && length(r) != 2)
 stop("'r' must be a \"range\", hence of length 2")
-r + c(-f,f) * diff(r)
-
+if(length(f) == 1) f <- rep(f, 2)
+r + c(-f[1], f[2]) * diff(r)
 }

Cheers,
M

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-25 Thread Randy Lai
It seems that the behavior of readLines() in R 3.5 has changed for non-blocking 
pipeline.


Consider the following R script, which reads from STDIN line by line.
```
con <- file("stdin")
open(con, blocking = FALSE)

while (TRUE) {
    txt <- readLines(con, 1)
    if (length(txt) > 0) {
        cat(txt, "\n", file = stdout())
    }
    Sys.sleep(0.1)
}
close(con)

```

In R 3.4.4, it works as expected.

```
(randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
abc
foo
```

In R 3.5, only the first line is printed
```
(randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
abc
```

Is this change expected?  If I change `blocking` to `TRUE` above, the above 
code would
work. But I need non-blocking connection in my use case of piping buffer from
another program.

Best,

R 3.5 @ macOS 10.13


Randy


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Bug in RScript.exe for 3.5.0

2018-04-25 Thread Tomas Kalibera
Thanks for the report. A quick workaround before this gets fixed is to 
add an extra first argument that has no space in it, e.g.


Rscript --vanilla "foo bar.R"

The problem exists on all systems, not just Windows.

Best
Tomas

On 04/25/2018 09:55 PM, Kerry Jackson wrote:

Hi R Developers,
I have found what I think is a bug in the RScript.exe in version 3.5.0 of R for 
Windows.
When I call Rscript.exe for Version 3.5 of R, it is unable to open the file if 
the file name or path has a space in it.
As an example of what happens, I saved 2 files with the code:
cat("What do you get when you multiply 6 * 9?")
as C:\foo bar.R and as C:\foo_bar.R
When I in a DOS command window try to run these using version 3.4.3 and 3.5:
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo bar.R"
Fatal error: cannot open file 'C:\foo': No such file or directory


C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>
When I try to run the file with a space in the name in version 3.5.0 of R, 
there is a fatal error saying there is no such file.


Kerry Jackson
Job title: Senior Account Manager, Ipsos Connect US RA Testing GMU
Phone: (203) 840-3443


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-25 Thread Michael Lawrence
Probably related to the switch to buffered connections. I will look
into this soon.

On Wed, Apr 25, 2018 at 2:34 PM, Randy Lai  wrote:
> It seems that the behavior of readLines() in R 3.5 has changed for 
> non-blocking pipeline.
>
>
> Consider the following R script, which reads from STDIN line by line.
> ```
> con <- file("stdin")
> open(con, blocking = FALSE)
>
> while (TRUE) {
> txt <- readLines(con, 1)
> if (length(txt) > 0) {
> cat(txt, "\n", file = stdout())
> }
> Sys.sleep(0.1)
> }
> close(con)
>
> ```
>
> In R 3.4.4, it works as expected.
>
> ```
> (randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
> abc
> foo
> ```
>
> In R 3.5, only the first line is printed
> ```
> (randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
> abc
> ```
>
> Is this change expected?  If I change `blocking` to `TRUE` above, the above 
> code would
> work. But I need non-blocking connection in my use case of piping buffer from
> another program.
>
> Best,
>
> R 3.5 @ macOS 10.13
>
>
> Randy
>
>
> [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Possible bug in package installation when R_ICU_LOCALE is set

2018-04-25 Thread Korpela Mikko (MML)
(Belated) thanks for the confirmation, Ista. I just reported this issue on the 
R bug tracker:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17412

Best regards,

- Mikko

-Alkuperäinen viesti-
Lähettäjä: Ista Zahn [mailto:istaz...@gmail.com] 
Lähetetty: 7. helmikuuta 2018 17:05
Vastaanottaja: Korpela Mikko (MML)
Kopio: r-devel@r-project.org
Aihe: Re: [Rd] Possible bug in package installation when R_ICU_LOCALE is set

I can reproduce this on Linux, so it is not Windows-specific.

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblas_haswellp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
LC_TIME=en_US.UTF-8
 [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.3 rmsfact_0.0.3  tools_3.4.3cowsay_0.5.0   fortunes_1.5-4


On Wed, Feb 7, 2018 at 8:38 AM, Korpela Mikko (MML) 
 wrote:
> On a Windows computer (other platforms not tested), installing a 
> package from source may fail if the environment variable R_ICU_LOCALE 
> is set, depending on the package and the locale.
>
> For example, after setting R_ICU_LOCALE to "fi_FI",
>
>   install.packages("seriation", type = "source")
>
> (package version 1.2-3) fails with the following error:
>
> ** preparing package for lazy loading
> Error in set_criterion_method("dist", "AR_events", criterion_ar_events,  :
>   could not find function "set_criterion_method"
> Error : unable to load R code in package 'seriation'
>
> Package "Epi" (version 2.24) fails similarly:
>
> ** preparing package for lazy loading
> Error in eval(exprs[i], envir) : object 'Relevel.default' not found 
> Error : unable to load R code in package 'Epi'
>
> Whether R_ICU_LOCALE is set before R is launched or during the session 
> doesn't matter: installation of these two example packages fails 
> either way. If R_ICU_LOCALE is unset, calling
>
>   icuSetCollate(locale = "fi_FI")
>
> is harmless. Browsing through the R manuals, I did not find warnings 
> against using R_ICU_LOCALE, or any indication why package installation 
> should fail with the variable being set. About the collation order of 
> R code files, "Writing R Extensions" says:
>
>> The default is to collate according to the 'C' locale.
>
> I interpret this (and the surrounding text) as a "promise" to package 
> developers that no matter what the end user does, the developer should 
> be able to rely on the collation order being 'C' unless the developer 
> defines another order.
>
>> sessionInfo()
> R version 3.4.3 Patched (2018-02-03 r74231)
> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 
> (build 7601) Service Pack 1
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=Finnish_Finland.1252  LC_CTYPE=Finnish_Finland.1252 [3] 
> LC_MONETARY=Finnish_Finland.1252 LC_NUMERIC=C [5] 
> LC_TIME=Finnish_Finland.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.4.3 tools_3.4.3
>
> --
> Mikko Korpela
> Chief Expert, Valuations
> National Land Survey of Finland
> Opastinsilta 12 C, FI-00520 Helsinki, Finland
> +358 50 462 6082
> www.maanmittauslaitos.fi
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel