similar to: R (development) changes in arith, logic, relop with (0-extent) arrays

Displaying 20 results from an estimated 50000 matches similar to: "R (development) changes in arith, logic, relop with (0-extent) arrays"

2016 Sep 07
3
R (development) changes in arith, logic, relop with (0-extent) arrays
Martin I'd like to make a comment; I think that R's behaviour on 'edge' cases like this is an important thing and it's great that you are working on it. I make heavy use of zero-extent arrays, chiefly because the dimnames are an efficient and logical way to keep track of certain types of information. If I have, for example, a <- array(0,c(2,0,2)) dimnames(a) <-
2016 Sep 08
2
R (development) changes in arith, logic, relop with (0-extent) arrays
Martin, Like Robin and Oliver I think this type of edge-case consistency is important and that it's fantastic that R-core - and you personally - are willing to tackle some of these "gotcha" behaviors. "Little" stuff like this really does combine to go a long way to making R better and better. I do wonder a bit about the x = 1:2 y = NULL x < y case. Returning a
2016 Sep 08
4
R (development) changes in arith, logic, relop with (0-extent) arrays
On Thu, Sep 8, 2016 at 10:05 AM, William Dunlap <wdunlap at tibco.com> wrote: > Shouldn't binary operators (arithmetic and logical) should throw an error > when one operand is NULL (or other type that doesn't make sense)? This is > a different case than a zero-length operand of a legitimate type. E.g., > any(x < 0) > should return FALSE if x is number-like
2016 Sep 08
1
R (development) changes in arith, logic, relop with (0-extent) arrays
Could we take a cue from min() and max()? > x <- 1:10 > min(x[x>7]) [1] 8 > min(x[x>11]) [1] Inf Warning message: In min(x[x > 11]) : no non-missing arguments to min; returning Inf > As ?min says, this is implemented to preserve transitivity, and this makes a lot of sense. I think the issuing of a warning here is a good compromise; I can always turn off warnings if I
2016 Sep 07
0
R (development) changes in arith, logic, relop with (0-extent) arrays
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 6 Sep 2016 22:26:31 +0200 writes: > Yesterday, changes to R's development version were committed, relating > to arithmetic, logic ('&' and '|') and > comparison/relational ('<', '==') binary operators > which in NEWS are
2016 Sep 08
0
R (development) changes in arith, logic, relop with (0-extent) arrays
>>>>> robin hankin <hankin.robin at gmail.com> >>>>> on Thu, 8 Sep 2016 10:05:21 +1200 writes: > Martin I'd like to make a comment; I think that R's > behaviour on 'edge' cases like this is an important thing > and it's great that you are working on it. > I make heavy use of zero-extent arrays, chiefly
2016 Sep 08
0
R (development) changes in arith, logic, relop with (0-extent) arrays
Shouldn't binary operators (arithmetic and logical) should throw an error when one operand is NULL (or other type that doesn't make sense)? This is a different case than a zero-length operand of a legitimate type. E.g., any(x < 0) should return FALSE if x is number-like and length(x)==0 but give an error if x is NULL. I.e., I think the type check should be done before the length
2016 Sep 09
1
R (development) changes in arith, logic, relop with (0-extent) arrays
Thank you, Gabe and Bill, for taking up the discussion. >>>>> William Dunlap <wdunlap at tibco.com> >>>>> on Thu, 8 Sep 2016 10:45:07 -0700 writes: > Prior to the mid-1990s, S did "length-0 OP length-n -> rep(NA, n)" and it > was changed > to "length-0 OP length-n -> length-0" to avoid lots of problems like
2016 Sep 08
0
R (development) changes in arith, logic, relop with (0-extent) arrays
On 09/08/2016 01:22 PM, Gabriel Becker wrote: > On Thu, Sep 8, 2016 at 10:05 AM, William Dunlap <wdunlap at tibco.com> wrote: > >> Shouldn't binary operators (arithmetic and logical) should throw an error >> when one operand is NULL (or other type that doesn't make sense)? This is >> a different case than a zero-length operand of a legitimate type. E.g.,
2016 Sep 08
0
R (development) changes in arith, logic, relop with (0-extent) arrays
Prior to the mid-1990s, S did "length-0 OP length-n -> rep(NA, n)" and it was changed to "length-0 OP length-n -> length-0" to avoid lots of problems like any(x<0) being NA when length(x)==0. Yes, people could code defensively by putting lots of if(length(x)==0)... in their code, but that is tedious and error-prone and creates really ugly code. Is your suggestion to
2016 Sep 08
2
R (development) changes in arith, logic, relop with (0-extent) arrays
Regarding Martin Maechler's proposal: Arithmetic between length-1 arrays and longer non-arrays had silently dropped the array attributes and recycled. This now gives a warning and will signal an error in the future, as it has always for logic and comparison operations For example, matrix(1,1,1) + (1:2) would give a warning/error. I think this might be a mistake. The potential
2016 Sep 09
3
R (development) changes in arith, logic, relop with (0-extent) arrays
> Radford Nea: > > So it may make more sense to move towards consistency in the > > permissive direction, rather than the restrictive direction. > > > That would mean allowing matrix(1,1,1) < (1:2), and maybe also things > > like matrix(1,2,2)+(1:8). > > Martin Maechler: > That is an interesting idea. Yes, in my view that would >
2016 Sep 09
0
R (development) changes in arith, logic, relop with (0-extent) arrays
>>>>> Radford Neal <radford at cs.toronto.edu> >>>>> on Thu, 8 Sep 2016 17:11:18 -0400 writes: > Regarding Martin Maechler's proposal: > Arithmetic between length-1 arrays and longer non-arrays had > silently dropped the array attributes and recycled. This now gives > a warning and will signal an error in the future, as it
2016 Sep 12
0
R (development) changes in arith, logic, relop with (0-extent) arrays
>>>>> Radford Neal <radford at cs.toronto.edu> >>>>> on Fri, 9 Sep 2016 10:29:14 -0400 writes: >> Radford Nea: >> > So it may make more sense to move towards consistency in the >> > permissive direction, rather than the restrictive direction. >> >> > That would mean allowing matrix(1,1,1) <
2015 Dec 11
3
For integer vectors, `as(x, "numeric")` has no effect.
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 8 Dec 2015 15:25:21 +0100 writes: >>>>> John Chambers <jmc at r-project.org> >>>>> on Mon, 7 Dec 2015 16:05:59 -0800 writes: >> We do need an explicit method here, I think. >> The issue is that as() uses methods for the generic
2003 Sep 10
4
recording and taking mean of a set of matrices
I'm looking for a good form in which to store matrix results of a simulation. I am doing a simulation study. Each simulation generates some data and then analyzes it. I want to record the results of many simulations and analyze them. Say r has the results of one simulation, and I care about r$coefficients, a vector of coefficients, and r$var, the estimated covariance matrix. I'll do
2004 May 27
2
block diagonal matrix function
Hello List I have just written a little function that takes two matrices as arguments and returns a large matrix that is composed of the two input matrices in upper-left position and lower-right position with a padding value everywhere else. (function definition and toy example below). I need nonsquare matrices and rowname() and colname() inherited appropriately. Two questions: (1) Is there a
2011 Nov 08
3
Reading a specific column of a csv file in a loop
Dear all: I have two larges files with 2000 columns. For each file I am performing a loop to extract the "i"th element of each file and create a data frame with both "i"th elements in order to perform further analysis. I am not extracting all the "i"th elements but only certain which I am indicating on a vector called "d". See an example of my code below
2013 Sep 05
2
binary symmetric matrix combination
Hi, May be this helps: m1<- as.matrix(read.table(text=" y1 g24 y1 0 1 g24 1 0 ",sep="",header=TRUE)) m2<-as.matrix(read.table(text="y1 c1 c2 l17 ?y1 0 1 1 1 ?c1 1 0 1 1 ?c2 1 1 0 1 ?l17 1 1 1 0",sep="",header=TRUE)) m3<- as.matrix(read.table(text="y1 h4??? s2???? s30 ?y1 0 1 1 1 ?h4 1 0 1 1 ?s2 1 1 0 1 ?s30 1 1 1
2016 Sep 07
0
R (development) changes in arith, logic relop with 0-extent arrays
On 09/07/2016 05:00 AM, r-devel-request at r-project.org wrote: > I've been slightly surprised (or even "frustrated") by the empty > reaction on our R-devel list to this post. > > I would have expected some critique, may be even some praise, > ... in any case some sign people are "thinking along" (as we say > in German). Have patience Martin. I read the