Skip to content

attempted merge() returns: cannot coerce type 'closure' to vector of type 'any'

1 message · Karl Brand

#
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