[Rd] edit() doubles backslashes when keep.source=TRUE

2020-05-14 Thread William Dunlap via R-devel
Is it just my installation or does edit() (or fix(), etc.) in R-4.0.0
double all the backslashes when options(keep.source=TRUE)?  E.g.,

> options(keep.source=TRUE)
> f <- function(x) { cat("\t", x, "\n", sep="") }
> edit(f) # exit the editor without making any changes
The editor (vi or notepad) shows doubled backslashes
function(x) { cat("\\t", x, "\\n", sep="") }
as does the return value of edit().

If I set options(keep.source=FALSE) before defining 'f' or remove t's
'srcref' attribute then the backslashes are left alone.

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] "cd" floating in the air in the man page for paste/paste0

2020-05-14 Thread Hervé Pagès

Thanks for the fix.

H.


On 5/12/20 23:29, Tomas Kalibera wrote:

Thanks, fixed.
Tomas

On 5/13/20 5:14 AM, Dirk Eddelbuettel wrote:

On 12 May 2020 at 19:59, Hervé Pagès wrote:
| While reading about the new 'recycle0' argument of paste/paste0, I
| spotted a mysterious "cd" floating in the air in the man page:
|
|    recycle0: ‘logical’ indicating if zero-length character arguments 
(and

|  all zero-length or no arguments when ‘collapse’ is not
|  ‘NULL’) should lead to the zero-length ‘character(0)’.
| cd
| ^^
|
| This is in R 4.0.0 Patched and R devel.

Also still in r-devel as of svn r78432:

   \item{recycle0}{\code{\link{logical}} indicating if zero-length
 character arguments (and all zero-length or no arguments when
 \code{collapse} is not \code{NULL}) should lead to the zero-length
 \code{\link{character}(0)}.}cd
 ^^

Dirk





--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


[Rd] system(timeout=) may timeout with 0 exit code

2020-05-14 Thread Jan Gorecki
Hi R developers,

I observed that system(timeout=) may still return exit code 0, when
killing the process due to timeout.

In src/unix/sys-unix.c there is

#define KILL_SIGNAL1 SIGINT
#define KILL_SIGNAL2 SIGTERM
#define KILL_SIGNAL3 SIGKILL
#define EMERGENCY_TIMEOUT 20

After little bit of debugging I observed that total time of system
call is provided timeout value + 20s. That means EMERGENCY_TIMEOUT 20
kicked in, adding 20 seconds.

I don't have a reproducible example, but following code, and output
file below should be enough to ensure that there is a problem there
(exit code 0 despite timeout).

warn = NULL
p = proc.time()[[3L]]
tryCatch(
  ret <- system(cmd, timeout=timeout_s),
  warning = function(w) {
warn <<- w[["message"]]
  }
)
if (length(warn) && ret==0L)
  cat(sprintf("command '%s' timed out(?) but still exited with 0 code,
timeout %ss, took %ss, warning '%s'\n",
  cmd, timeout_s, proc.time()[[3L]]-p, warn),
file="timeout-exit-codes.out", append=TRUE)

And the content of timeout-exit-codes.out:

command '/bin/bash -c "./_launcher/solution.R > log.out 2> log.err"'
timed out(?) but still exited with 0 code, timeout 7200s, took
7220.005s, warning '/bin/bash -c "./_launcher/solution.R > log.out 2>
log.err"' timed out after 7200s'

Thank you,
Jan Gorecki

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


Re: [Rd] justify hard coded in format.ftable

2020-05-14 Thread SOEIRO Thomas
I suspected it was partly due to the fact that ftable doesn't get much 
interest/isn't much used...

So thank you very much for answering, and for your time!

>> Dear all,
>> I haven't received any feedback so far on my proposal to make "justify" 
>> argument available in stats:::format.ftable
>>
>> Is this list the appropriate place for this kind of proposal?
> 
> Yes, it is.. Actually such a post is even a "role model" post for R-devel.
> 
>> I hope this follow-up to my message won't be taken as rude. Of course it's 
>> not meant to be, but I'm not used to the R mailing lists...
> 
> well, there could be said much, and many stories told here ... ;-)
> 
>> Thank you in advance for your comments,
>> 
>> Best,
>> Thomas
> 
> The main reasons for "no reaction" (for such nice post) probably are 
> combination of the following
> 
> - we are busy
> - if we have time, we think other things are more exciting
> - we have not used ftable much/at all and are not interested.
> 
> Even though the first 2 apply to me, I'll have a 2nd look into your post now, 
> and may end up well agreeing with your proposal.
> 
> Martin Maechler
> ETH Zurich  and  R Core team
> 
>>> Dear all,
>>>
>>> justify argument is hard coded in format.ftable:
>>>
>>> cbind(apply(LABS, 2L, format, justify = "left"),
>>> apply(DATA, 2L, format, justify = "right"))
>>>
>>> It would be useful to have the possibility to modify the argument between 
>>> c("left", "right", "centre", "none") as in format.default.
>>>
>>> The lines could be changed to:
>>>
>>> if(length(justify) != 2)
>>> stop("justify must be length 2")
>>> cbind(apply(LABS, 2L, format, justify = justify[1]),
>>> apply(DATA, 2L, format, justify = justify[2]))
>>>
>>> The argument justify could defaults to c("left", "right") for backward 
>>> compatibility.
>>>
>>> It could then allow:
>>> ftab <- ftable(wool + tension ~ breaks, warpbreaks)
>>> format.ftable(ftab, justify = c("none", "none"))
>>>
>>> Best regards,
>>>
>>> Thomas
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] justify hard coded in format.ftable

2020-05-14 Thread Martin Maechler
> SOEIRO Thomas 
> on Wed, 13 May 2020 20:27:15 + writes:

> Dear all,
> I haven't received any feedback so far on my proposal to make "justify" 
argument available in stats:::format.ftable

> Is this list the appropriate place for this kind of proposal?

Yes, it is.. Actually such a post is even a "role model" post
for R-devel.

> I hope this follow-up to my message won't be taken as rude. Of course 
it's not meant to be, but I'm not used to the R mailing lists...

well, there could be said much, and many stories told here ... ;-)

> Thank you in advance for your comments,

> Best,
> Thomas

The main reasons for "no reaction" (for such nice post) probably
are combination of the following

- we are busy
- if we have time, we think other things are more exciting
- we have not used ftable much/at all and are not interested.

Even though the first 2 apply to me, I'll have a 2nd look into
your post now, and may end up well agreeing with your proposal.

Martin Maechler
ETH Zurich  and  R Core team




>> Dear all,
>> 
>> justify argument is hard coded in format.ftable:
>> 
>> cbind(apply(LABS, 2L, format, justify = "left"),
>> apply(DATA, 2L, format, justify = "right"))
>> 
>> It would be useful to have the possibility to modify the argument 
between c("left", "right", "centre", "none") as in format.default.
>> 
>> The lines could be changed to:
>> 
>> if(length(justify) != 2)
>> stop("justify must be length 2")
>> cbind(apply(LABS, 2L, format, justify = justify[1]),
>> apply(DATA, 2L, format, justify = justify[2]))
>> 
>> The argument justify could defaults to c("left", "right") for backward 
compatibility.
>> 
>> It could then allow:
>> ftab <- ftable(wool + tension ~ breaks, warpbreaks)
>> format.ftable(ftab, justify = c("none", "none"))
>> 
>> Best regards,
>> 
>> Thomas

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