Re: [Rd] selectMethod() can fail to find methods in situations of multiple dispatch

2019-03-19 Thread Michael Lawrence via R-devel
This is due to the intentional truncation of ANY suffixes from method signatures. I've hacked selectMethod() to be robust to that and will commit soon. Thanks for the report. Michael On Thu, Mar 14, 2019 at 9:32 AM Pages, Herve wrote: > Here is an example: > > setGeneric("foo", function(x, y)

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread Henning Bredel
Okay, thanks for clarification. On 3/19/19 10:51 AM, peter dalgaard wrote: > You are using it wrong. It wants strings of the form "name=value", not a > character vector with names as labels. So this is closer to the mark: > >> system2("echo", env = c("VAR='Hello World'"), args = c("$VAR")) > >> >

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread Gábor Csárdi
Right. I suppose, one thing you can do is setting the env var in the current process, call system2() and then unset/restore the env var. This is unlikely to cause problems, unless your R process is multi-threaded, and the env var causes troubles in the other threads. The withr package makes setting

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread peter dalgaard
On Windows, ‘env’ is only supported for commands such as ‘R’ and ‘make’ which accept environment variables on their command line. So I suppose that would be tricky. The basic issue is that on Unix-alikes, system2 constructs a command like FOO=bar cmd args and passes that to sh via sy

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread Gábor Csárdi
On Tue, Mar 19, 2019 at 9:59 AM peter dalgaard wrote: [...] > What you need is something like (NB: single quotes!) > > system2("sh", env = c("VAR='Hello World'"), args = c("-c 'echo $VAR'")) > Hello World Just out of curiosity, do you think it is possible to make this portable, assuming sh is ava

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread peter dalgaard
You are using it wrong. It wants strings of the form "name=value", not a character vector with names as labels. So this is closer to the mark: > system2("echo", env = c("VAR='Hello World'"), args = c("$VAR")) > However, as you see it doesn't work as intended. The problem is that the $-substitu

Re: [Rd] Possibly broken system2 env-option

2019-03-19 Thread Gábor Csárdi
Probably not broken, just hard to get the quoting right? Or it does not work with echo? It is surely hard to get it right, I have been trying for 15 minutes.I am pretty sure that the correct form is env = "VAR='Hello-World'" but spaces and other special characters might cause trouble. E.g. this wo

[Rd] Possibly broken system2 env-option

2019-03-19 Thread Henning Bredel
Hey all, what is wrong with this command: system2("echo", env = c(VAR = "Hello World"), args = c("$VAR")) I am a bit confused, as help("system2") writes about the env option: > character vector of name=value strings to set environment variables. Is this option buggy, or am I using it just wr