Displaying 20 results from an estimated 6000 matches similar to: "rank(, ties.method="last")"
2015 Oct 22
1
(no subject)
------------------
>>>>> 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------------------------------
>>> Den 2015-10-09 kl. 12:14, skrev Martin Maechler:
>>> I think so: the code above
2015 Oct 08
3
rank(, ties.method="last")
Hi,
I ran into a problem where I actually need rank(, ties.method="last"). It would
be great to have this feature in base and it's also simple to get (see below).
Thanks & cheers,
Marius
rank2 <- function (x, na.last = TRUE, ties.method = c("average",
"first", "last", # new "last"
"random", "max",
2015 Oct 20
0
rank(, ties.method="last")
On Tue, Oct 20, 2015 at 10:26 AM, Henric Winell
<nilsson.henric at gmail.com> wrote:
> 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 right
2018 Apr 06
2
Part of fastpass in 'sort.list' can make sorting unstable
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, violating stability of sorting.
Example:
x <- sort(c(1, 1, 3))
x # 1
2017 Apr 12
3
"table(droplevels(aq)$Month)" in manual page of droplevels
The last line of the example in droplevels' manual page seems to be incorrect to me. I think it should read: "table(droplevels(aq$Month))". Amazingly (I don't understand) both variants seem to produce the same result (R 3.3.3):
---
> aq <- transform(airquality, Month = factor(Month, labels = month.abb[5:9]))
> aq <- subset(aq, Month != "Jul")
>
2017 Feb 07
2
package load altering RNG state
>>>>> Henric Winell <nilsson.henric at gmail.com>
>>>>> on Tue, 7 Feb 2017 13:37:42 +0100 writes:
> Hi, On 2017-02-07 13:12, Benjamin Tyner wrote:
>> Hello
>>
>> When loading a package, I'm wondering if it's frowned
>> upon for the package to alter the state of the random
>> number
2016 Sep 26
2
Undocumented 'use.names' argument to c()
By "an argument named 'use.names' is included for concatenation", I meant something like this, that someone might try.
> c(as.Date("2016-01-01"), use.names=FALSE)
use.names
"2016-01-01" "1970-01-01"
See, 'use.names' is in the output. That's precisely because 'c.Date' doesn't have 'use.names', so
2017 Apr 12
2
"table(droplevels(aq)$Month)" in manual page of droplevels
Hello,
Inline.
Em 12-04-2017 16:40, Henric Winell escreveu:
> (Let's keep the discussion on-list -- I've added back R-devel.)
>
> On 2017-04-12 16:39, Ulrich Windl wrote:
>
>>>>> Henric Winell <nilsson.henric at gmail.com> schrieb am 12.04.2017
>>>>> um 15:35 in
>> Nachricht <b66fe849-bb8d-f00d-87e5-553f866d57e0 at gmail.com>:
2019 May 30
2
stopifnot
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 +0000
+++ stop_new.R 2019-05-30 14:01:51.372187466 +0000
@@ -31,7 +31,7 @@
.Internal(stop(call., .makeMessage(..., domain = domain)))
}
2017 Nov 04
1
ans[nas] <- NA in 'ifelse' (was: ifelse() woes ... can we agree on a ifelse2() ?)
Removal of
ans[nas] <- NA
from the code of function 'ifelse' in R is not committed (yet). Why?
--------------------------------------------
On Mon, 28/11/16, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?
Cc: R-devel at r-project.org, maechler at stat.math.ethz.ch
Date: Monday, 28 November, 2016, 10:00
2012 Dec 06
2
factor(x, exclude=y) if x is a factor
I found this part in the documentation of 'factor'.
'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. If 'exclude' is used it should
also be a factor with the same level set as 'x' or a set of codes
for the levels to be excluded.
2017 May 18
2
stopifnot() does not stop at first non-TRUE argument
>From an example in http://www.uni-muenster.de/ZIV.BennoSueselbeck/s-html/helpfiles/nargs.html , number of arguments in '...' can be obtained by
(function(...)nargs())(...) .
I now realize that sys.call() doesn't expand '...' when the function is called with '...'. It just returns the call as is. If 'stopifnot' uses sys.call() instead of match.call() , the
2017 Aug 19
1
Issues of R_pretty in src/appl/pretty.c
Yes, they work now.
I mentioned them partly because the commit description said overflow for large n and partly to be considered for regression tests.
--------------------------------------------
On Sat, 19/8/17, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] Issues of R_pretty in src/appl/pretty.c
Cc: r-devel at r-project.org
Date: Saturday, 19 August, 2017,
2017 Aug 18
1
Issues of R_pretty in src/appl/pretty.c
Examples similar to
pretty(c(-1,1)*1e300, n = 1e9, min.n = 1)
with smaller 'n':
pretty(c(-1,1)*1e304, n = 1e5, min.n = 1)
pretty(c(-1,1)*1e306, n = 1e3, min.n = 1)
A report on 'pretty' when working with integers, similar to what led to change of 'seq' fuzz, is https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15137
--------------------------------------------
On Tue,
2014 Mar 06
2
'parallel' package changes '.Random.seed'
Hi,
I've implemented parallelization in one of my packages using the
'parallel' package -- many thanks for providing it!
In my package I'm importing 'parallel' and so added it to the
DESCRIPTION file's 'Import:' tag and also added a
'importFrom("parallel", ...)' statement in the NAMESPACE file.
Parallelization works nicely, but my package
2017 Feb 07
2
package load altering RNG state
Hello
When loading a package, I'm wondering if it's frowned upon for the
package to alter the state of the random number generator? I guess not,
since the parallel package does it?
> set.seed(6860)
> old.seed <- .GlobalEnv$.Random.seed
> library(parallel)
> new.seed <- .GlobalEnv$.Random.seed
> identical(old.seed, new.seed)
[1] FALSE
I ask
2017 Aug 11
2
Issues of R_pretty in src/appl/pretty.c
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 1000000 intervals
(on a machine), made me trace through the code to function 'R_pretty' in https://svn.r-project.org/R/trunk/src/appl/pretty.c .
*lo is
2019 Mar 05
2
stopifnot
Another possible shortcut definition:
assert <- function(exprs)
do.call("stopifnot", list(exprs = substitute(exprs), local = parent.frame()))
After thinking again, I propose to use
??? ? ? stop(simpleError(msg, call = if(p <- sys.parent()) sys.call(p)))
- It seems that the call is the call of the frame where stopifnot(...) is evaluated. Because that is the correct context, I
2018 Mar 24
1
Function 'factor' issues
I am trying once again.
By just changing
f <- match(xlevs[f], nlevs)
to
f <- match(xlevs, nlevs)[f]
, function 'factor' in R devel could be made more consistent and back-compatible. Why not picking it?
--------------------------------------------
On Sat, 25/11/17, Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com> wrote:
Subject: Re: [Rd] Function
2016 Sep 09
2
R-intro: function 'stderr' and 'sd'
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 a builtin function sd().
The part "in this case was unnecessary as R also