Re: [Rd] unexpected behavior of `[<-` method for class unit.arithmetic

2009-09-25 Thread baptiste auguie
Further to my previous message, I just dug this in lattice/R/layout.R : rearrangeUnit <- function(x, pos, u) { lx <- length(x) if (lx == 1) u else if (pos == 1) unit.c(u, x[(pos+1):lx]) else if (pos == lx) unit.c(x[1:(pos-1)], u) else unit.c(x[1

Re: [Rd] unexpected behavior of `[<-` method for class unit.arithmetic

2009-09-25 Thread baptiste auguie
Dear Paul and others, Thanks for the quick response. 2009/9/25 Paul Murrell : > Hi > > The bit you found that says ... > > # Write "[<-.unit" methods too ?? > > ... is the crucial bit. > When I figured that, I had already written up my email so I thought I'd ask anyway from a naive user point of

Re: [Rd] unexpected behavior of `[<-` method for class unit.arithmetic

2009-09-24 Thread Paul Murrell
Hi The bit you found that says ... # Write "[<-.unit" methods too ?? ... is the crucial bit. Would it be possible to add such a method? Almost certainly, it just needs someone to repeatedly bug the person who can make the change :) Thanks for the suggestion for code BTW; I'll take a look

[Rd] unexpected behavior of `[<-` method for class unit.arithmetic

2009-09-24 Thread baptiste auguie
Dear list, Consider the following, library(grid) w = unit.c(unit(1, "in"), unit(2, "in")) w2 = w + unit(1, "mm") w[2] <- 0 w2[2] <- 0 convertUnit(w, "mm") #[1] 25.4mm 0mm convertUnit(w2, "mm") #Error in grid.Call("L_convert", x, as.integer(whatfrom), as.integer(whatto), : # INTEGER() can onl