Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Hervé Pagès
Hi, On 10/24/2014 06:58 AM, S Ellison wrote: Also note that these warnings or errors are complaining that the number of items to replace (left length) is not a multiple of replacement length (right length). This suggests that when the left length is a multiple of the right length, everything is

Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread S Ellison
> > Also note that these warnings or errors are complaining that the > > number of items to replace (left length) is not a multiple of > > replacement length (right length). This suggests that when the left > > length is a multiple of the right length, everything is fine. > > And this is actually t

Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Henrik Bengtsson
On Oct 24, 2014 1:59 AM, "Hervé Pagès" wrote: > > Hi Henrik, > > > On 10/23/2014 08:10 PM, Henrik Bengtsson wrote: >> >> Assigning one or more values to a vector/matrix/array x for which >> length(x) == 0 gives no error, e.g. >> >>> x <- integer(0) >>> x[] <- 1:2 >> >> >>> x <- matrix(nrow=0, ncol

Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Hervé Pagès
Hi Henrik, On 10/23/2014 08:10 PM, Henrik Bengtsson wrote: Assigning one or more values to a vector/matrix/array x for which length(x) == 0 gives no error, e.g. x <- integer(0) x[] <- 1:2 x <- matrix(nrow=0, ncol=1) x[] <- 1:2 x[,1] <- 1:2 x <- array(dim=c(0,1,1)) x[] <- 1:2 x[,1,1] <- 1

[Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-23 Thread Henrik Bengtsson
Assigning one or more values to a vector/matrix/array x for which length(x) == 0 gives no error, e.g. > x <- integer(0) > x[] <- 1:2 > x <- matrix(nrow=0, ncol=1) > x[] <- 1:2 > x[,1] <- 1:2 > x <- array(dim=c(0,1,1)) > x[] <- 1:2 > x[,1,1] <- 1:2 whereas > x <- integer(1) > x[] <- 1:2 Warning