[R] attempted merge() returns: cannot coerce type 'closure' to vector of type 'any'
Karl Brand
k.brand at erasmusmc.nl
Wed Dec 1 15:35:09 CET 2010
Hi Dimtris and esteemed useRs,
I don't understand why i get this error message when attempting to use
merge() -
> temp <- merge(x, y[,17, drop=FALSE], by=rownames, sort=FALSE)
Error in as.vector(x, mode) :
cannot coerce type 'closure' to vector of type 'any'
It should work because:
> all(rownames(x[order(rownames(x)),]) ==
+ rownames(y[order(rownames(y[,17, drop=FALSE])),17, drop=FALSE]) ....
[TRUNCATED]
[1] TRUE
also:
> class(x); class(y[,17, drop=FALSE])
[1] "matrix"
[1] "matrix"
Any idea why i cant use merge() in the normal way here? I'm forced to
add the column using:
temp.b <- cbind(x, y[match(rownames(x), rownames(y)),17])
All insights appreciated for this leaRner,
cheers,
Karl
--
Karl Brand <k.brand at erasmusmc.nl>
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3211 | F +31 (0)10 704 4743 | M +31 (0)642 777 268
More information about the R-help
mailing list