On 5/21/08, Henrik Bengtsson <[EMAIL PROTECTED]> wrote: > Hi, > > right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that: > > > rawToChar(raw(0)) > [1] "" > > rawToChar(raw(0), multiple=TRUE) > character(0) > > Is this intended or should both return character(0)? Personally, I > would prefer that an empty input vector returns an empty output > vector.
I don't see why; rawToChar(, multiple=FALSE) is meant to be a map from an n-vector to a scalar. Why should there be an exception when n==0? Would you expect mean(numeric(0)) to return numeric(0)? > Same should then apply to charToRaw(), but right now we get: > > > x <- character(0) > > charToRaw(x) > Error in charToRaw(x) : argument must be a character vector of length 1 The error message says it all: charToRaw() maps a scalar to an n-vector. For vectors of length > 1, it uses the first element with a warning. No comments on the rest. -Deepayan > [...] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel