Re: [Rd] scan(..., skip=1e11): infinite loop; cannot interrupt

2023-03-13 Thread Suharto Anggono Suharto Anggono via R-devel
With  if (!j--) {  R_CheckUserInterrupt();  j = 1;  } as in current R devel (r83976), j goes negative (-1) and interrupt is checked every 10001 instead of 1. I prefer  if (!--j) {  R_CheckUserInterrupt();  j = 1;  } . In current R devel (r83976), if EOF is 

Re: [Rd] Bug with `[<-.POSIXlt` on specific OSes

2022-10-30 Thread Suharto Anggono Suharto Anggono via R-devel
 zero --- On Saturday, 22 October 2022, 07:12:51 pm GMT+7, Martin Maechler   wrote: >>>>> Martin Maechler >>>>>on Tue, 18 Oct 2022 10:56:25 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>

Re: [Rd] Bug with `[<-.POSIXlt` on specific OSes

2022-10-14 Thread Suharto Anggono Suharto Anggono via R-devel
I think '[.POSIXlt' and '[<-.POSIXlt' don't need to normalize out-of-range  values. I think they just make same length for all components, to ensure  correct extraction or replacement for arbitrary index. I have a thought of adding an optional argument for 'as.POSIXlt' applied to  "POSIXlt" 

Re: [Rd] as.character.POSIXt in R devel

2022-10-07 Thread Suharto Anggono Suharto Anggono via R-devel
46:08 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>>    on Sun, 2 Oct 2022 08:42:50 + (UTC) writes:     >> With r82904, 'as.character.POSIXt' in R devel is changed. The NEWS item:     >> as.character() now behaves more in line wi

Re: [Rd] as.character.POSIXt in R devel

2022-10-06 Thread Suharto Anggono Suharto Anggono via R-devel
ctober 2022, 11:58:53 pm GMT+7, Martin Maechler   wrote: >>>>> Martin Maechler >>>>>on Mon, 3 Oct 2022 14:46:08 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>>on Sun, 2 Oct 2022 08:42:50 + (UTC) writes:

[Rd] as.character.POSIXt in R devel

2022-10-02 Thread Suharto Anggono Suharto Anggono via R-devel
With r82904, 'as.character.POSIXt' in R devel is changed. The NEWS item: as.character() now behaves more in line with the    methods for atomic vectors such as numbers, and is no longer    influenced by options(). Part of the code:    s <- trunc(x$sec) fs <- x$sec - s r1 <- 

Re: [Rd] gettext(msgid, domain="R") doesn't work for some 'msgid':s

2021-11-06 Thread Suharto Anggono Suharto Anggono via R-devel
This issue has come up before: https://stat.ethz.ch/pipermail/r-help/2013-February/346721.html ("gettext wierdness"), https://stat.ethz.ch/pipermail/r-devel/2007-December/047893.html ("gettext() and messages in 'pkg' domain"). Using 'ngettext' is a workaround, like in

[Rd] formatC() doesn't keep attributes

2021-10-08 Thread Suharto Anggono Suharto Anggono via R-devel
By r80949, 'formatC' code in R devel has     if (!(n <- length(x))) return(character()) If 'x' has length zero, the return value of 'formatC' doesn't have attributes. It doesn't follow the documented "Value": "A character object of the same size and attributes as x". Based on my observation,

[Rd] In function isum in summary.c, k should be R_xlen_t

2020-12-31 Thread Suharto Anggono Suharto Anggono via R-devel
In summary.c, in function 'isum', the loop is 'ITERATE_BY_REGION' that contains 'for' loop for (int k = 0; k < nbatch; k++) It is since SVN revision 73445, in released R since version 3.5.0. Previously, the loop is for (R_xlen_t i = 0; i < n; i++) Inside 'ITERATE_BY_REGION', the type of the

[Rd] Documentation on 'recycle0' argument of 'paste'

2020-09-18 Thread Suharto Anggono Suharto Anggono via R-devel
This is about R 4.0.2 (or 4.0.1) help on 'paste'. End part of the first paragraph in "Details" section: If the arguments are vectors, they are concatenated term-by-term to give a  character vector result. Vector arguments are recycled as needed, with  zero-length arguments being recycled to '""' 

[Rd] R-intro: Appendix A: attach position

2019-09-11 Thread Suharto Anggono Suharto Anggono via R-devel
In "An Introduction to R", in "Appendix A  A sample session", in the part on Michelson data, information for attach(mm) is Make the data frame visible at position 3 (the default). In fact, the 'attach' is at position 2. __ R-devel@r-project.org

Re: [Rd] methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error

2019-07-04 Thread Suharto Anggono Suharto Anggono via R-devel
In 'conformMethod', there is another instance of omittedSig & . It just affects error message. Original:     if(any(is.na(match(signature[omittedSig], c("ANY", "missing") {         bad <- omittedSig & is.na(match(signature[omittedSig], c("ANY", "missing"))) After r76756:     if(any(iiN <-

Re: [Rd] stopifnot

2019-05-30 Thread Suharto Anggono Suharto Anggono via R-devel
Here is a patch to function 'stopifnot' that adds 'evaluated' argument and makes 'exprs' argument in 'stopifnot' like 'exprs' argument in 'withAutoprint'. --- stop.R 2019-05-30 14:01:15.282197286 + +++ stop_new.R 2019-05-30 14:01:51.372187466 + @@ -31,7 +31,7 @@

Re: [Rd] stopifnot

2019-04-14 Thread Suharto Anggono Suharto Anggono via R-devel
: Re: [Rd] stopifnot Cc: r-devel@r-project.org Date: Monday, 1 April, 2019, 8:12 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>>    on Sun, 31 Mar 2019 15:26:13 + writes: [.] [ "eval() inside for()" not giving call in

Re: [Rd] stopifnot -- eval(*) inside for()

2019-04-02 Thread Suharto Anggono Suharto Anggono via R-devel
gt; Suharto Anggono Suharto Anggono via R-devel >>>>>on Sun, 31 Mar 2019 15:26:13 + writes: > Ah, with R 3.5.0 or R 3.4.2, but not with R 3.3.1, 'eval' > inside 'for' makes compiled version behave like > non-compiled version. Ah.. ... thank you for detec

Re: [Rd] stopifnot

2019-03-31 Thread Suharto Anggono Suharto Anggono via R-devel
Ah, with R 3.5.0 or R 3.4.2, but not with R 3.3.1, 'eval' inside 'for' makes compiled version behave like non-compiled version. options(error = expression(NULL)) library(compiler) enableJIT(0) f <- function(x) for (i in 1) {x; eval(expression(i))} f(is.numeric(y)) # Error: object 'y' not found

[Rd] Inappropriate "Unix-alike platforms" in txtProgressBar.Rd in R devel

2019-03-18 Thread Suharto Anggono Suharto Anggono via R-devel
In current R devel (r76247), "See Also" section of help page on 'txtProgressBar' (https://svn.r-project.org/R/trunk/src/library/utils/man/txtProgressBar.Rd) has "Unix-alike platforms" as a detail on 'tkProgressBar': \seealso{ \code{\link{winProgressBar}} (Windows only),

Re: [Rd] stopifnot

2019-03-07 Thread Suharto Anggono Suharto Anggono via R-devel
By not using 'withCallingHandler' or 'tryCatch', the state is like 'stopifnot' in R 3.4.x. If 'stopifnot' becomes faster than in R 3.4.x when the expressions given to 'stopifnot' are all TRUE, it is because 'match.call' is not called. Credit is to

Re: [Rd] stopifnot

2019-03-05 Thread Suharto Anggono Suharto Anggono via R-devel
On Mon, 4/3/19, Martin Maechler wrote: Subject: Re: [Rd] stopifnot Cc: r-devel@r-project.org Date: Monday, 4 March, 2019, 4:59 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>>    on Sat, 2 Mar 2019 08:28:23 +0000 writes: >>>&

Re: [Rd] stopifnot

2019-03-02 Thread Suharto Anggono Suharto Anggono via R-devel
Instead of if(!is.null(names(cl))) names(cl) <- NULL , just names(cl) <- NULL looks simpler and the memory usage and speed is not bad in my little experiment. Subject: Re: [Rd] stopifnot To: r-devel@r-project.org Date: Saturday, 2 March, 2019,

Re: [Rd] stopifnot

2019-03-02 Thread Suharto Anggono Suharto Anggono via R-devel
A private reply by Martin made me realize that I was wrong about stopifnot(exprs=TRUE) . It actually works fine. I apologize. What I tried and was failed was stopifnot(exprs=T) . Error in exprs[[1]] : object of type 'symbol' is not subsettable The shortcut assert <- function(exprs)

Re: [Rd] stopifnot

2019-02-27 Thread Suharto Anggono Suharto Anggono via R-devel
+ p <- sys.parent(2) + stop(simpleError(msg, call = if(p) sys.call(p))) } } invisible() -------------------- On Wed, 27/2/19, Martin Maechler wrote: Subject: Re: [Rd] stopifnot Cc: r-devel@r-project.org Date: Wednesday,

[Rd] stopifnot

2019-02-24 Thread Suharto Anggono Suharto Anggono via R-devel
>From https://github.com/HenrikBengtsson/Wishlist-for-R/issues/70 : ... and follow up note from 2018-03-15: Ouch... in R-devel, stopifnot() has become yet 4-5 times slower; ... which is due to a complete rewrite using tryCatch() and withCallingHandlers(). >From

Re: [Rd] Extract.data.frame.Rd about $.data.frame

2019-02-18 Thread Suharto Anggono Suharto Anggono via R-devel
--- On Fri, 15/2/19, Martin Maechler wrote: Subject: Re: [Rd] Extract.data.frame.Rd about $.data.frame Cc: r-devel@r-project.org Date: Friday, 15 February, 2019, 4:15 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>>on Sun, 10 Feb 2019 16:33:25 +00

[Rd] Extract.data.frame.Rd about $.data.frame

2019-02-10 Thread Suharto Anggono Suharto Anggono via R-devel
In R devel, data.frame method of '$' has been removed, but this part of "Details" section of Extract.data.frame.Rd still implies existence of the method. The \code{data.frame} method for \code{$}, treats \code{x} as a list, except that (as of R-3.1.0) partial matching of \code{name} to

[Rd] Redundant code in 'split.default' in R devel

2018-10-05 Thread Suharto Anggono Suharto Anggono via R-devel
After r75387, function 'split.default' in R devel still has this part that no longer has effect. lf <- levels(f) y <- vector("list", length(lf)) names(y) <- lf __ R-devel@r-project.org mailing list

Re: [Rd] Proposal: more accurate seq(from, to, length=n)

2018-09-08 Thread Suharto Anggono Suharto Anggono via R-devel
urate seq(from, to, length=n) Cc: "r-devel" Date: Saturday, 8 September, 2018, 5:38 AM Suharto, My 2c inline. On Fri, Sep 7, 2018 at 2:34 PM, Suharto Anggono Suharto Anggono via R-devel wrote: In R, seq(0, 1, 0.1) gives the same result as (0:10)*0.1. It is not the same

[Rd] Proposal: more accurate seq(from, to, length=n)

2018-09-07 Thread Suharto Anggono Suharto Anggono via R-devel
In R, seq(0, 1, 0.1) gives the same result as (0:10)*0.1. It is not the same as c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1) , as 0.1 is not represented exactly. I am fine with it. In R, seq(0, 1, length=11) gives the same result as seq(0, 1, 0.1). However, for seq(0, 1, length=11), it

Re: [Rd] aic() component in GLM-family objects

2018-06-19 Thread Suharto Anggono Suharto Anggono via R-devel
In R, family has aic component since version 0.62. There is no aic component in family in R 0.61.3. Looking at blame, https://github.com/wch/r-source/blame/tags/R-0-62/src/library/base/R/family.R , aic component in family is introduced in svn revision 640

Re: [Rd] length of `...`

2018-05-06 Thread Suharto Anggono Suharto Anggono via R-devel
Does anyone notice r-devel thread "stopifnot() does not stop at first non-TRUE argument" starting with https://stat.ethz.ch/pipermail/r-devel/2017-May/074179.html ? I have mentioned (function(...)nargs())(...) in https://stat.ethz.ch/pipermail/r-devel/2017-May/074294.html . Something like

[Rd] Result of 'seq' doesn't use compact internal representation

2018-04-28 Thread Suharto Anggono Suharto Anggono via R-devel
> .Internal(inspect(1:10)) @300e4e8 13 INTSXP g0c0 [NAM(3)] 1 : 10 (compact) > .Internal(inspect(seq(1,10))) @3b6e1f8 13 INTSXP g0c4 [] (len=10, tl=0) 1,2,3,4,5,... > system.time(1:1e7) user system elapsed 0 0 0 > system.time(seq(1,1e7)) user system elapsed 0.05

[Rd] Part of fastpass in 'sort.list' can make sorting unstable

2018-04-06 Thread Suharto Anggono Suharto Anggono via R-devel
In the code of functions 'order' and 'sort.list' in R 3.5.0 alpha (in https://svn.r-project.org/R/branches/R-3-5-branch/src/library/base/R/sort.R), in "fastpass, take advantage of ALTREP metadata", there is "try the reverse since that's easy too...". If it succeeds, ties are reordered,

Re: [Rd] Nice names in deparse

2018-03-29 Thread Suharto Anggono Suharto Anggono via R-devel
I am raising this again. As as.character(list(c(one = "1"))) is still "1" in R 3.5.0 alpha, could as.character(list(c(one = 1))) be "1" , too, as before? The case here is the list component is atomic with length 1. On Sat, 16/12/17, Suharto Anggono

Re: [Rd] Function 'factor' issues

2018-03-23 Thread Suharto Anggono Suharto Anggono via R-devel
at.math.ethz.ch> wrote: Subject: Re: [Rd] Function 'factor' issues Cc: r-devel@r-project.org Date: Wednesday, 18 October, 2017, 11:54 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>>    on Sun, 15 Oct 2017 16:03:48 + writes

Re: [Rd] Inappropriate parens fix for Logic.Rd

2018-03-17 Thread Suharto Anggono Suharto Anggono via R-devel
Logic.Rd has been changed again in r74377. After change:   \item{x, y}{raw or logical or \sQuote{number-like} vectors (i.e., of     types \code{\link{double}} (class \code{\link{numeric}},     \code{\link{integer}}) and \code{\link{complex}}), or objects for It is still inappropriate. As I said

[Rd] Inappropriate parens fix for Logic.Rd

2018-03-09 Thread Suharto Anggono Suharto Anggono via R-devel
Logic.Rd is one of the files changed in r74363. Before change: \item{x, y}{raw or logical or \sQuote{number-like} vectors (i.e., of types \code{\link{double}} (class \code{\link{numeric}}), \code{\link{integer}} and \code{\link{complex}})), or objects for After change: \item{x,

[Rd] Nice names in deparse

2017-12-16 Thread Suharto Anggono Suharto Anggono via R-devel
Tags (argument names) in call to 'list' becomes names of the result. It is not necessarily so with call to 'c'. The default method of 'c' has 'recursive' and 'use.names' arguments. In R devel r73778, with x <- 0; names(x) <- "recursive"  , dput(x) or even dput(x, control = "all") gives

Re: [Rd] Function 'factor' issues

2017-11-25 Thread Suharto Anggono Suharto Anggono via R-devel
Wed, 18/10/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote: Subject: Re: [Rd] Function 'factor' issues Cc: r-devel@r-project.org Date: Wednesday, 18 October, 2017, 11:54 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>

[Rd] ans[nas] <- NA in 'ifelse' (was: ifelse() woes ... can we agree on a ifelse2() ?)

2017-11-04 Thread Suharto Anggono Suharto Anggono via R-devel
R-devel@r-project.org, maech...@stat.math.ethz.ch Date: Monday, 28 November, 2016, 10:00 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Sat, 26 Nov 2016 17:14:01 + writes: ... > On current 'ifelse' code in R: > * The part &g

Re: [Rd] Function 'factor' issues

2017-10-21 Thread Suharto Anggono Suharto Anggono via R-devel
ate: Wednesday, 18 October, 2017, 11:54 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>>    on Sun, 15 Oct 2017 16:03:48 + writes:       > In R devel, function 'factor' has been changed, allowing and merging duplicated 'labe

[Rd] Function 'factor' issues

2017-10-15 Thread Suharto Anggono Suharto Anggono via R-devel
In R devel, function 'factor' has been changed, allowing and merging duplicated 'labels'. Issue 1: Handling of specified 'labels' without duplicates is slower than before. Example: x <- rep(1:26, 4) system.time(factor(x, levels=1:26, labels=letters)) Function 'factor' is already rather

[Rd] Revert to R 3.2.x code of logicalSubscript in subscript.c?

2017-10-01 Thread Suharto Anggono Suharto Anggono via R-devel
Currently, in function 'logicalSubscript' in subscript.c, the case of no recycling is handled like the implentation of R function 'which'. It passes through the data only once, but uses more memory. It is since R 3.3.0. For the case of recycling, two passes are done, first to get number of

[Rd] NEWS item about PR#17284

2017-09-18 Thread Suharto Anggono Suharto Anggono via R-devel
Previous mentions: - https://stat.ethz.ch/pipermail/r-devel/2017-July/074723.html - https://stat.ethz.ch/pipermail/r-devel/2017-August/074737.html The NEWS item corresponding to PR#17284 is in "CHANGES in R-devel". However, fix for PR#17284 is already included in R 3.4.2 beta.

[Rd] R_xlen_t is an integer type

2017-08-27 Thread Suharto Anggono Suharto Anggono via R-devel
A recent R devel NEWS item: approx(), spline(), splinefun() and approxfun() also work for long vectors. In current R devel, in function 'approx1' in src/library/stats/src/approx.c and in function 'spline_eval' in src/library/stats/splines.c, in #ifdef LONG_VECTOR_SUPPORT there is a comment

Re: [Rd] Issues of R_pretty in src/appl/pretty.c

2017-08-19 Thread Suharto Anggono Suharto Anggono via R-devel
Issues of R_pretty in src/appl/pretty.c Cc: r-devel@r-project.org Date: Saturday, 19 August, 2017, 7:47 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>> on Fri, 18 Aug 2017 15:44:06 + writes: > Examples similar

Re: [Rd] Issues of R_pretty in src/appl/pretty.c

2017-08-18 Thread Suharto Anggono Suharto Anggono via R-devel
esday, 15 August, 2017, 3:55 PM >>>>> Martin Maechler <maech...@stat.math.ethz.ch> >>>>>     on Mon, 14 Aug 2017 11:46:07 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>>     on Fri,

[Rd] Issues of R_pretty in src/appl/pretty.c

2017-08-11 Thread Suharto Anggono Suharto Anggono via R-devel
See https://stat.ethz.ch/pipermail/r-devel/2017-August/074746.html for the origin of the example here. That pretty(c(-1,1)*1e300, n = 1e9, min.n = 1) gave 20 intervals, far from 1e9, but pretty(c(-1,1)*1e300, n = 1e6, min.n = 1) gave 100 intervals (on a machine), made me trace through the

Re: [Rd] translateChar in NewName in bind.c

2017-08-01 Thread Suharto Anggono Suharto Anggono via R-devel
rg Date: Monday, 31 July, 2017, 8:38 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Sun, 30 Jul 2017 14:57:53 + writes: > R devel's bind.c has been ported to R patched. Is it OK while names of 'unlist' or 'c' result may be not st

Re: [Rd] translateChar in NewName in bind.c

2017-07-30 Thread Suharto Anggono Suharto Anggono via R-devel
NewName in bind.c @r-project.org Date: Tuesday, 13 June, 2017, 2:35 PM Thanks, fixed in R-devel. Best Tomas On 06/11/2017 02:30 PM, Suharto Anggono Suharto Anggono via R-devel wrote: > I see another thing in function 'NewName' in bind.c. In > else if (*CHAR(tag)) , > 'ans' is

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-14 Thread Suharto Anggono Suharto Anggono via R-devel
- On Sat, 10/6/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote: Subject: Re: [Rd] [bug] droplevels() also drop object attributes (comment…) To: "R Development" <R-devel@r-project.org> Cc: "Serge Bibauw" <sbib...@gmail.com>

Re: [Rd] translateChar in NewName in bind.c

2017-06-11 Thread Suharto Anggono Suharto Anggono via R-devel
I see another thing in function 'NewName' in bind.c. In else if (*CHAR(tag)) , 'ans' is basically copied from 'tag'. Could the whole thing there be just the following? ans = tag; It seems to me that it can also replace ans = R_BlankString; in 'else'; so, else if (*CHAR(tag)) and else can be

[Rd] translateChar in NewName in bind.c

2017-06-10 Thread Suharto Anggono Suharto Anggono via R-devel
In function 'NewName' in bind.c (https://svn.r-project.org/R/trunk/src/main/bind.c), in else if (*CHAR(base)) , 'translateChar' is used. Should it be 'translateCharUTF8' instead? The end result is marked as UTF-8: mkCharCE(cbuf, CE_UTF8) Other cases already use 'translateCharUTF8'.

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-08 Thread Suharto Anggono Suharto Anggono via R-devel
* Be careful with "contrasts" attribute. If the number of levels is reduced, the original contrasts matrix is no longer valid. Example case: x <- factor(c("a", "a", "b", "b", "b"), levels = c("a", "b", "c")) contrasts(x) <- contr.treatment(levels(x), contrasts=FALSE)[, -2, drop=FALSE]

Re: [Rd] stopifnot() does not stop at first non-TRUE argument

2017-05-18 Thread Suharto Anggono Suharto Anggono via R-devel
Re: [Rd] stopifnot() does not stop at first non-TRUE argument Cc: r-devel@r-project.org Date: Thursday, 18 May, 2017, 3:03 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Tue, 16 May 2017 16:37:45 + writes: > switch(i, ...) > ex

Re: [Rd] stopifnot() does not stop at first non-TRUE argument

2017-05-16 Thread Suharto Anggono Suharto Anggono via R-devel
switch(i, ...) extracts 'i'-th argument in '...'. It is like eval(as.name(paste0("..", i))) . Just mentioning other things: - For 'n', n <- nargs() can be used. - sys.call() can be used in place of match.call() . --- > peter dalgaard > on Mon, 15 May 2017

[Rd] c documentation after change

2017-04-19 Thread Suharto Anggono Suharto Anggono via R-devel
In R 3.4.0 RC, argument list of 'c' as S4 generic function has become (x, ...) . However, "S4 methods" section in documentation of 'c' (c.Rd) is not updated yet. Also, in R 3.4.0 RC, 'c' method of class "Date" ('c.Date') is still not explicitly documented.

Re: [Rd] complex NA's match(), etc: not back-compatible change proposal

2017-04-01 Thread Suharto Anggono Suharto Anggono via R-devel
I am raising this again. With z <- complex(real = c(0,NaN,NaN), imaginary = c(NA,NA,0)) , results of sapply(z, match, table = z) and match(z, z) are different in R 3.4.0 alpha. I think they should be the same. I suggest changing 'cequal' in unique.c such that a complex number that has both NA

Re: [Rd] rep/rep.int: in NEWS, but not yet ported from trunk

2017-02-27 Thread Suharto Anggono Suharto Anggono via R-devel
:20 PM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Sun, 26 Feb 2017 12:02:44 + writes: > According to "CHANGES IN R 3.3.2 patched" in NEWS, rep(x, > times) and rep.int(x, times) also work when 'times' has > length greater

[Rd] rep/rep.int: in NEWS, but not yet ported from trunk

2017-02-26 Thread Suharto Anggono Suharto Anggono via R-devel
According to "CHANGES IN R 3.3.2 patched" in NEWS, rep(x, times) and rep.int(x, times) also work when 'times' has length greater than one and has element larger than the maximal integer. In fact, it is still not the case in R 3.3.3 beta r72259. In seq.c

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-07 Thread Suharto Anggono Suharto Anggono via R-devel
ecified 'default' is NaN. On Sat, 4/2/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote: Subject: Re: [Rd] RFC: tapply(*, ..., init.value = NA) Cc: R-devel@r-project.org Date: Saturday, 4 February, 2017, 10:48 PM >>>>>

[Rd] Lack of 'seq_len' in 'head' in 'stopifnot'

2017-02-04 Thread Suharto Anggono Suharto Anggono via R-devel
Function 'stopifnot' in R devel r72104 has this. head <- function(x, n = 6L) ## basically utils:::head.default() x[if(n < 0L) max(length(x) + n, 0L) else min(n, length(x))] If definition like utils:::head.default is intended, the index of 'x' should be wrapped in seq_len(...):

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-01 Thread Suharto Anggono Suharto Anggono via R-devel
[Rd] RFC: tapply(*, ..., init.value = NA) Cc: R-devel@r-project.org Date: Wednesday, 1 February, 2017, 12:14 AM >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Tue, 31 Jan 2017 15:43:53 + writes: > Function 'aggregate.data.frame' in R has taken a differ

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-31 Thread Suharto Anggono Suharto Anggono via R-devel
Function 'aggregate.data.frame' in R has taken a different route. With drop=FALSE, the function is also applied to subset corresponding to combination of grouping variables that doesn't appear in the data (example 2 in https://stat.ethz.ch/pipermail/r-devel/2017-January/073678.html). Because

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Suharto Anggono Suharto Anggono via R-devel
The "no factor combination" case is distinguishable by 'tapply' with simplify=FALSE. > D2 <- data.frame(n = gl(3,4), L = gl(6,2, labels=LETTERS[1:6]), N=3) > D2 <- D2[-c(1,5), ] > DN <- D2; DN[1,"N"] <- NA > with(DN, tapply(N, list(n,L), FUN=sum, simplify=FALSE)) ABCDEF 1

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-29 Thread Suharto Anggono Suharto Anggono via R-devel
Interspersed below. Subject: Re: ifelse() woes ... can we agree on a ifelse2() ? To: r-de...@lists.r-project.org Date: Sunday, 27 November, 2016, 12:14 AM On current 'ifelse' code in R: ... * If 'test' is a factor, doing storage.mode(test) <-

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
Related to the length of 'ifelse' result, I want to say that "example of different return modes" in ?ifelse led me to perceive a wrong thing in the past. ## example of different return modes: yes <- 1:3 no <- pi^(0:3) typeof(ifelse(NA,yes, no)) # logical

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
For S Ellison, just clarifying, I am Suharto Anggono, not Martin Maechler. "Martin et al.," from my previous E-mail was the beginning of message from Gabriel Becker, that I quoted. The quoted "still a bit disappointed that nobody has taken a look" is from Martin Maechler. In all of the proposed

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
Just stating, in 'ifelse', 'test' is not recycled. As I said in "R-intro: length of 'ifelse' result" (https://stat.ethz.ch/pipermail/r-devel/2016-September/073136.html), ifelse(condition, a, b) returns a vector of the length of 'condition', even if 'a' or 'b' is longer. On current 'ifelse'

[Rd] Potential integer overflow in 'do_mapply'

2016-11-14 Thread Suharto Anggono Suharto Anggono via R-devel
Function 'do_mapply' in mapply.c has the following fragment. for (int i = 0; i < longest; i++) { Variable 'longest' is declared as R_xlen_t. Its value can be larger than the maximum int. In the fragment, when 'longest' is larger than the maximum int, when 'i' reaches the maximum int, i++

[Rd] lapply on long vector fails

2016-10-29 Thread Suharto Anggono Suharto Anggono via R-devel
I report here that, in RStudio in Data Scientist Workbench, lapply(raw(2^31), function(x) NULL) failed after not so long time. > res <- lapply(raw(2^31), function(x) NULL) Error in FUN(X[[i]], ...) : long vectors not supported yet: memory.c:1652 > sessionInfo() R version 3.3.1 (2016-06-21)

[Rd] 'max' on mixed numeric and character arguments

2016-10-08 Thread Suharto Anggono Suharto Anggono via R-devel
Bug 17160 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17160) leads me to ask this. In R, should max(...) equals max(c(...)) ? If 'max' have both numeric and character arguments, should lexicographic sorting be used for all? > max("", 3, 10) [1] "3" > max("", c(3, 10)) [1] "10" >

Re: [Rd] Undocumented 'use.names' argument to c()

2016-09-26 Thread Suharto Anggono Suharto Anggono via R-devel
uot;R-devel" <R-devel@r-project.org> Date: Sunday, 25 September, 2016, 10:14 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>> on Sun, 25 Sep 2016 14:12:10 + writes: >> From comments in &

Re: [Rd] Undocumented 'use.names' argument to c()

2016-09-25 Thread Suharto Anggono Suharto Anggono via R-devel
nly the recursive argument was considered >>> special. >>> >>> Sys.funs.c: >>> 405 S_unlist(vector *ent, vector *arglist, s_evaluator *S_evaluator) >>> 406 { >>> 407 int which = sys_index; boolean named, recursive

Re: [Rd] Undocumented 'use.names' argument to c()

2016-09-23 Thread Suharto Anggono Suharto Anggono via R-devel
In S-PLUS 3.4 help on 'c' (http://www.uni-muenster.de/ZIV.BennoSueselbeck/s-html/helpfiles/c.html), there is no 'use.names' argument. Because 'c' is a generic function, I don't think that changing formal arguments is good. In R devel r71344, 'use.names' is not an argument of functions

[Rd] R-intro: length of 'ifelse' result

2016-09-14 Thread Suharto Anggono Suharto Anggono via R-devel
In "An Introduction to R" Version 3.3.1, in "9.2.1 Conditional execution: if statements", the last paragraph is the following: There is a vectorized version of the if/else construct, the ifelse function. This has the form ifelse(condition, a, b) and returns a vector of the length of its longest

Re: [Rd] table(exclude = NULL) always includes NA

2016-09-09 Thread Suharto Anggono Suharto Anggono via R-devel
Looking at the code of function 'table' in R devel r71227, I see that the part "remove NA level if it was added only for excluded in factor(a, exclude=.)" is not quite right. In is.na(a) <- match(a0, c(exclude,NA), nomatch=0L) , I think that what is intended is

[Rd] R-intro: function 'stderr' and 'sd'

2016-09-09 Thread Suharto Anggono Suharto Anggono via R-devel
In "An Introduction to R" Version 3.3.1, in "4.2 The function tapply() and ragged arrays", after stderr <- function(x) sqrt(var(x)/length(x)) , there is a note in brackets: Writing functions will be considered later in [Writing your own functions], and in this case was unnecessary as R also has

[Rd] Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)

2016-09-02 Thread Suharto Anggono Suharto Anggono via R-devel
gust, 2016, 2:51 PM >>>>> Martin Maechler <maech...@stat.math.ethz.ch> >>>>> on Sat, 27 Aug 2016 18:55:37 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>> on Sat, 27 Au

Re: [Rd] 'droplevels' inappropriate change

2016-08-26 Thread Suharto Anggono Suharto Anggono via R-devel
In R devel r71157, 'droplevels' documentation, in "Arguments" section, says this about argument 'exclude'. passed to factor(); factor levels which should be excluded from the result even if present. Note that this was implicitly NA in R <= 3.3.1 which did drop NA levels even when present in x,

[Rd] 'droplevels' inappropriate change

2016-08-21 Thread Suharto Anggono Suharto Anggono via R-devel
In R devel r71124, if 'x' is a factor, droplevels(x) gives factor(x, exclude = NULL) . In R 3.3.1, it gives factor(x) . If a factor 'x' has NA and levels of 'x' doesn't contain NA, factor(x) gives the expected result for droplevels(x) , but factor(x, exclude = NULL) doesn't. As I said in

Re: [Rd] table(exclude = NULL) always includes NA

2016-08-16 Thread Suharto Anggono Suharto Anggono via R-devel
The quirk as in table(1:3, exclude = 1, useNA = "ifany") is actually somewhat documented, and still in R devel r71104. In R help on 'table', in "Details" section: It is best to supply factors rather than rely on coercion. In particular, ‘exclude’ will be used in coercion to a factor, and so

Re: [Rd] table(exclude = NULL) always includes NA

2016-08-13 Thread Suharto Anggono Suharto Anggono via R-devel
t;maech...@stat.math.ethz.ch> @r-project.org Date: Saturday, 13 August, 2016, 4:29 AM >>>>> Martin Maechler <maech...@stat.math.ethz.ch> >>>>> on Fri, 12 Aug 2016 10:12:01 +0200 writes: >>>>> Suharto Anggono Suharto Anggono via R-devel <r-d

Re: [Rd] table(exclude = NULL) always includes NA

2016-08-11 Thread Suharto Anggono Suharto Anggono via R-devel
e: Subject: Re: [Rd] table(exclude = NULL) always includes NA @r-project.org Cc: "Martin Maechler" <maech...@stat.math.ethz.ch> Date: Thursday, 11 August, 2016, 12:39 AM >>>>> Martin Maechler <maech...@stat.math.ethz.ch> >>>>> on Tue, 9 Aug 2

[Rd] table(exclude = NULL) always includes NA

2016-08-07 Thread Suharto Anggono Suharto Anggono via R-devel
This is an example from https://stat.ethz.ch/pipermail/r-help/2007-May/132573.html . With R 2.7.2: > a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1) > table(a, b, exclude = NULL) b a 1 2 11 1 22 0 31 0 1 0 With R 3.3.1: > a <- c(1, 1, 2, 2, NA, 3); b <-

Re: [Rd] complex NA's match(), etc: not back-compatible change proposal

2016-06-03 Thread Suharto Anggono Suharto Anggono via R-devel
ematic once  Problem 1 is solved according to '1 A', because it least  length(unique(.)) would not change:  It would contain *one* z[] with an NA, and all the other z[]s. Opinions ?  Thank you in advance for chiming in.. Martin Maechler, ETH Zurich     > On Mon, 23/5/16, Martin

[Rd] factor(x, exclude=NULL) for factor x; names in as.factor()

2016-05-30 Thread Suharto Anggono Suharto Anggono via R-devel
In R 3.3.0 (also in R 2.7.2), the documentation on 'factor', in "Details" section, has this statement. 'factor(x, exclude = NULL)' applied to a factor is a no-operation unless there are unused levels: in that case, a factor with the reduced level set is returned. It is not true for a factor

Re: [Rd] complex NA's match(), etc: not back-compatible change proposal

2016-05-28 Thread Suharto Anggono Suharto Anggono via R-devel
ck-compatible change proposal Cc: R-devel@r-project.org Date: Monday, 23 May, 2016, 11:06 PM >>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel@r-project.org> >>>>>     on Fri, 13 May 2016 16:33:05 + writes:     > That, for example, comp

[Rd] PR# for match.arg(arg)

2016-04-08 Thread Suharto Anggono Suharto Anggono via R-devel
In "R News", in "Changes in R 3.3.0", in "New Features", a news item is match.arg(arg) (the one-argument case) is faster; so is sort.int(). (PR#16640) While it was motivated by speeding up tapply, it is in a separate bug number: 16652 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16652).

[Rd] %OS on output

2016-02-24 Thread Suharto Anggono Suharto Anggono via R-devel
R help on 'strptime' has the following in "Details" section. Specific to R is ‘%OSn’, which for output gives the seconds truncated to ‘0 <= n <= 6’ decimal places (and if ‘%OS’ is not followed by a digit, it uses the setting of ‘getOption("digits.secs")’, or if that is unset, ‘n = 3’). In

[Rd] On recent change to 'prettyDate'

2016-02-24 Thread Suharto Anggono Suharto Anggono via R-devel
A news entry for R 3.2.3 patched: pretty(D) for date-time objects D now also works well if range(D) is (much) smaller than a second. In the case of only one unique value in D, the pretty range now is more symmetric around that value than previously. Similarly, pretty(dt) no longer returns a

[Rd] (no subject)

2015-10-21 Thread Suharto Anggono Suharto Anggono via R-devel
-- >>>>> Henric Winell <[hidden email]> >>>>> on Wed, 21 Oct 2015 13:43:02 +0200 writes: > Den 2015-10-21 kl. 07:24, skrev Suharto Anggono Suharto Anggono via R-devel: >> Marius Hofert-4--

Re: [Rd] rank(, ties.method="last")

2015-10-20 Thread Suharto Anggono Suharto Anggono via R-devel
Marius Hofert-4-- > Den 2015-10-09 kl. 12:14, skrev Martin Maechler: > I think so: the code above doesn't seem to do the right thing. Consider > the following example: > > > x <- c(1, 1, 2, 3) > > rank2(x, ties.method = "last") > [1] 1 2 4 3 > > That doesn't look

Re: [Rd] 'vapply' not returning list element names when returned element is a length-1 list

2015-08-05 Thread Suharto Anggono Suharto Anggono via R-devel
Quote If i have a function that returns a named list with 2 (or more) elements, then using 'vapply' retains the names of the elements: But if the function only returns one element, then the name foo is lost vapply _always simplifies_ according to the documentation. In

Re: [Rd] WISH: eval() to preserve the visibility (now value is always visible)

2015-02-08 Thread Suharto Anggono Suharto Anggono via R-devel
Sorry to intervene. Argument passed to 'eval' is evaluated first. So, eval(x - 2) is effectively like { x - 2; eval(2) } , which is effectively { x - 2; 2 } . The result is visible. eval(expression(x - 2)) or eval(quote(x - 2)) or evalq(x - 2) gives the same effect as x - 2 . The result is