Displaying 20 results from an estimated 11000 matches similar to: "ordering of raw vectors"
2014 May 07
0
Historical NA question (Herv? Pag?s)
"Equivalence" certainly does not mean that literally replacing some text will not change the result.
>From "R language definition", p. 11:
> Except for the syntax, there is no difference between applying an operator and calling a
function. In fact, x + y can equivalently be written ?+?(x, y). Notice that since ?+? is a nonstandard
function name, it needs to be quoted.
2014 Mar 27
3
[Bioc-devel] Conflicting definitions for function redefined as S4 generics
On 03/27/2014 02:13 AM, Ulrich Bodenhofer wrote:
> I fully agree, Michael, that this would be a great thing to have! I have
> often wondered why R and the standard packages are still sticking so
> much to the old-style S3 flavor though S4 is part of standard R. I
> acknowledge that backward compatibility is important, but, as far as I
> got it, redefining a function or S3 generic as
2019 Mar 22
0
selectMethod() can fail to find methods in situations of multiple dispatch
Agreed but I'm not sure we want users accessing documentation with those
types of aliases. One option is the method?foo("numeric") syntax.
On Thu, Mar 21, 2019 at 9:52 PM Pages, Herve <hpages at fredhutch.org> wrote:
> Fine with me as long as eliminating the inconveniences associated with it
> can be put on the roadmap. The alias instability and the fact that the user
2005 Apr 14
0
predict.glm(..., type="response") dropping names (and a propsed (PR#7792)
Here's a patch that should make predict.glm(..., type="response") retain the
names. The change passes make check on our Opteron running SLES9. One
simple test is:
names(predict(glm(y ~ x, family=binomial,
data=data.frame(y=c(1, 0, 1, 0), x=c(1, 1, 0, 0))),
newdata=data.frame(x=c(0, 0.5, 1)), type="response"))
which gives
[1]
2018 Jan 30
0
as.list method for by Objects
On 01/30/2018 02:50 PM, Michael Lawrence wrote:
> by() does not always return a list. In Gabe's example, it returns an
> integer, thus it is coerced to a list. as.list() means that it should be
> a VECSXP, not necessarily with "list" in the class attribute.
The documentation is not particularly clear about what as.list()
means for list derivatives. IMO clarifications
2017 Nov 29
2
binary form of is() contradicts its unary form
Yes, data.frame is not an S4 class but is(data.frame())
finds its super-classes anyway and without the need to wrap
it in asS4(). And "list' is one of the super-classes. Then
is(data.frame(), "list") contradicts this.
I'm not asking for a workaround. I already have one with
'class2 %in% is(object)' as reported in my original post.
'is(asS4(object), class2)'
2005 Dec 20
0
pmin(), pmax() - slower than necessary for common cases
A few hours ago, I was making a small point on the R-SIG-robust
mailing list on the point that ifelse() was not too efficient
in a situation where pmax() could easily be used instead.
However, this has reminded me of some timing experiments that I
did 13 years ago with S-plus -- where I found that pmin() /
pmax() were really relatively slow for the most common case
where they are used with only
2012 Nov 15
0
R-devel Digest, Vol 117, Issue 13
Hi,
> ... Wrong. It looks like internally a[[1]] is always used instead of a[[i]].
> The real problem it seems is that 'a' is treated as if it was of
> ength 1:
>
> > mapply(function(x, y) {x * y}, a, 1:3)
> [1] 101 202 303
> > mapply(function(x, y) {x * y}, a, 5)
> [1] 505
>
> In other words, internal dispatch works for [[ but not for length().
2011 Aug 02
0
png() broken in R-devel
Hi,
Seems like this recent change broke the png() device:
hpages at latitude:~/svn/R-devel/src/library/grDevices/src$ svn diff -r
56568:56569
Index: cairo/Makefile.in
===================================================================
--- cairo/Makefile.in (revision 56568)
+++ cairo/Makefile.in (revision 56569)
@@ -38,7 +38,8 @@
R: Makefile
@$(MAKE) $(cairo_la)
- @cp $(cairo_la)
2016 Mar 19
0
unary class union of an S3 class
On Sat, Mar 19, 2016 at 4:29 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> On 03/19/2016 01:22 AM, Michael Lawrence wrote:
>
>>
>>
>> On Sat, Mar 19, 2016 at 12:10 AM, Herv? Pag?s <hpages at fredhutch.org
>> <mailto:hpages at fredhutch.org>> wrote:
>>
>> On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>>
>>
>>
2017 Nov 29
0
binary form of is() contradicts its unary form
Hi Herve,
Interesting observation with `setClass` but it is for S4. It looks
like `data.frame()` is not an S4 class.
> isS4(data.frame())
[1] FALSE
And in your case this might help:
> is(asS4(data.frame()), "list")
[1] TRUE
Looks like `is` is designed for S4 classes, I am not entirely sure.
Best,
-Mehmet
On 29 November 2017 at 20:46, Herv? Pag?s <hpages at
2019 Mar 22
0
selectMethod() can fail to find methods in situations of multiple dispatch
If we started over, I'd try to avoid this sort of complexity, but "ANY"
truncation has been happening since at least 2003.
> matchSignature(c("numeric", "ANY"), foo)
x
"numeric"
So I'm not sure we want to mess with it.
Michael
On Thu, Mar 21, 2019 at 8:14 PM Pages, Herve <hpages at fredhutch.org> wrote:
> Hi Michael,
>
2017 May 03
0
stopifnot() does not stop at first non-TRUE argument
On 05/03/2017 12:04 PM, Herv? Pag?s wrote:
> Not sure why the performance penalty of nonstandard evaluation would
> be more of a concern here than for something like switch().
which is actually a primitive. So it seems that there is at least
another way to go than 'dots <- match.call(expand.dots=FALSE)$...'
Thanks,
H.
>
> If that can't/won't be fixed, what about
2015 Sep 29
1
making object.size() more meaningful on environments?
Hi Gabe,
On 09/29/2015 02:51 PM, Gabriel Becker wrote:
> Herve,
>
> The problem then would be that for A a refClass whose fields take up N
> bytes (in the sense that you mean), if we do
>
> B <- A
>
> A and B would look like the BOTH take up N bytes, for a total of 2N,
> whereas AFAIK R would only be using ~ N + 2*56 bytes, right?
Yes, but that's still a *much*
2020 May 24
0
paste(character(0), collapse="", recycle0=FALSE) should be ""
Herve (et al.),
On Fri, May 22, 2020 at 3:16 PM Herv? Pag?s <hpages at fredhutch.org> wrote:
> Gabe,
>
> It's the current behavior of paste() that is a major source of bugs:
>
> ## Add "rs" prefix to SNP ids and collapse them in a
> ## comma-separated string.
> collapse_snp_ids <- function(snp_ids)
> paste("rs", snp_ids,
2020 May 22
0
paste(character(0), collapse="", recycle0=FALSE) should be ""
I think that
paste(c("a", "b"), NULL, c("c", "d"), sep = " ", collapse = ",",
recycle0=TRUE)
should just return an empty string and don't see why it needs to emit a
warning or raise an error. To me it does exactly what the user is asking
for, which is to change how the 3 arguments are recycled **before** the
'sep'
2019 Mar 22
2
selectMethod() can fail to find methods in situations of multiple dispatch
Fine with me as long as eliminating the inconveniences associated with it can be put on the roadmap. The alias instability and the fact that the user has no way to know if s/he should do ?`foo,numeric-method` or ?`foo,numeric,ANY-method` to find the method has been a long-standing problem.
H.
On 3/21/19 21:29, Michael Lawrence wrote:
If we started over, I'd try to avoid this sort of
2013 Dec 13
1
substring() and propagation of names
Hi,
In R < 3.0.0, we used to get:
> substring(c(A="abcdefghij", B="123456789"), 2, 6:2)
A B A B A
"bcdef" "2345" "bcd" "23" "b"
But in R >= 3.0.0, we get:
> substring(c(A="abcdefghij", B="123456789"), 2, 6:2)
[1] "bcdef"
2018 Jan 30
0
as.list method for by Objects
Hi Gabe,
Interestingly the behavior of as.list() on by objects seem to
depend on the object itself:
> b1 <- by(1:2, 1:2, identity)
> class(as.list(b1))
[1] "list"
> b2 <- by(warpbreaks[, 1:2], warpbreaks[,"tension"], summary)
> class(as.list(b2))
[1] "by"
This is with R 3.4.3 and R devel (2017-12-11 r73889).
H.
On 01/30/2018 02:33 PM,
2003 Jan 31
2
minor error in documentation of pmax in base (PR#2513)
The documentation says, "pmax and pmin take several vectors as
arguments and return a single vector giving the parallel maxima
(or minima) of the vectors."
I discovered that, if you use a matrix or array instead of a
vector, pmax returns a matrix or array, respectively.
This makes pmax and pmin much more useful, and should not be left
to people to discover on their own!
For example: