similar to: Historical NA question (Herv? Pag?s)

Displaying 20 results from an estimated 9000 matches similar to: "Historical NA question (Herv? Pag?s)"

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 understand that this is consistent but it also strikes me as an enormous 'gotcha' of a magnitude that 'we' are trying to avoid/smooth over at this point in user-facing R space. For the record I'm not suggesting it should return something other than "", and in particular I'm not arguing that any call to paste *that does not return an error* with non-NULL
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().
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'
2020 May 21
0
paste(character(0), collapse="", recycle0=FALSE) should be ""
>>>>> Herv? Pag?s >>>>> on Fri, 15 May 2020 13:44:28 -0700 writes: > There is still the situation where **both** 'sep' and 'collapse' are > specified: >> paste(integer(0), "nth", sep="", collapse=",") > [1] "nth" > In that case 'recycle0' should **not** be
2020 May 22
5
paste(character(0), collapse="", recycle0=FALSE) should be ""
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, sep="", collapse=",") snp_groups <- list( group1=c(55, 22, 200), group2=integer(0), group3=c(99,
2013 Apr 23
1
about the 'length' arg of vector()
Hi, In the man page for vector(): length: A non-negative integer specifying the desired length. Double values will be coerced to integer: supplying an argument of length other than one is an error. Since long vectors are supported, it doesn't seem to be true anymore that "double values will be coerced to integer": > bigraw <-
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)'
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"
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
2013 Jul 13
2
missing PROTECT() in src/main/arithmetic.c
at lines 651 & 653 (integer_binary function): if (code == DIVOP || code == POWOP) ans = allocVector(REALSXP, n); else ans = allocVector(INTSXP, n); There are calls to warningcall() later in the function, which can trigger garbbage collection. Looks like the typical scenario where it seemed pretty safe to not PROTECT in the original version of the function but
2011 Dec 07
4
bug in rank(), order(), is.unsorted() on character vector
Hi, This looks OK: > x <- c("_1_", "1_9", "2_9") > rank(x) [1] 1 2 3 But this does not: > xa <- paste(x, "a", sep="") > xa [1] "_1_a" "1_9a" "2_9a" > rank(xa) [1] 2 1 3 Cheers, H. > sessionInfo() R version 2.14.0 (2011-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1]
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: >> >> >>
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
2012 Oct 11
1
as.data.frame.matrix() returns an invalid object
Hi, Two ways to create what should normally be the same data frame: > df1 <- data.frame(a=character(0), b=character(0))> df1 [1] a b <0 rows> (or 0-length row.names) > df2 <- as.data.frame(matrix(character(0), ncol=2, dimnames=list(NULL, letters[1:2]))) > df2 [1] a b <0 rows> (or 0-length row.names) unique() works as expected except that I
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
2011 Sep 23
1
broken save(..., compress="xy")
Hi, With current R devel and R 2.13.1: > aa=1:5 > save(aa, file="aa.rda", compress="xy") Error in identical(compress, "gzip") || compress : invalid 'y' type in 'x || y' Thanks! H. > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C [3]
2013 Jul 29
1
duplicated.data.frame() is broken on data frames containing \r
Hi, The trick used by duplicated.data.frame() is to transform the supplied data.frame into a character vector by pasting together the columns using "\r" as separator. But no precautions are taken to deal with "\r" in the supplied data.frame. As a consequence it's easy to imagine situations where duplicated.data.frame() returns an incorrect answer: > df <-
2020 May 22
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
I agree with Herve, processing collapse happens last so collapse=non-NULL always leads to a single character string being returned, the same as paste(collapse=""). See the altPaste function I posted yesterday. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, May 22, 2020 at 9:12 AM Herv? Pag?s <hpages at fredhutch.org> wrote: > I think that > >
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*