From: Gabor Grothendieck <ggrothendieck_at_myway.com>

Date: Mon 18 Oct 2004 - 01:43:45 EST

R-devel@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Oct 18 01:49:35 2004

Date: Mon 18 Oct 2004 - 01:43:45 EST

I would have thought it would be an error to attempt and fail. Actually, to make it a vector all that has to be done is to zap the dim attribute:

dim(x1mat) <- NULL # now its a vector

It seems to know how to do that in the case of an atomic matrix, just not a non-atomic one. Here it is for an atomic matrix where it does return TRUE:

is.vector(as.vector(matrix(1:12,4))) # TRUE

<Matthias.Kohl <at> uni-bayreuth.de> writes:

*:
*

: maybe, the point is that is.vector "attempts to coerce its argument into a

*: vector", but here it fails
**:
**: is.matrix(as.vector(x1mat))
**: [1] TRUE
**:
**: Matthias
**:
**: >
**: > The following, which was recently discussions on the rcom-l list,
**: > is a situation where coercing x1mat to a vector using as.vector
**: > results in an object that is.vector says is not a vector:
**: >
**: > R> x1mat<-matrix(list(1,1.1,1+1i,"a",NA,NaN), 3, 2)
**: > R> is.vector(as.vector(x1mat))
**: > [1] FALSE
**: >
**: > ______________________________________________
**: > R-devel <at> stat.math.ethz.ch mailing list
**: > https://stat.ethz.ch/mailman/listinfo/r-devel
**:
**: ______________________________________________
**: R-devel <at> stat.math.ethz.ch mailing list
**: https://stat.ethz.ch/mailman/listinfo/r-devel
**:
*

:

R-devel@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Oct 18 01:49:35 2004

*
This archive was generated by hypermail 2.1.8
: Wed 03 Nov 2004 - 22:45:22 EST
*