nat icon indicating copy to clipboard operation
nat copied to clipboard

Allow xyzmatrix method to assign by rownames

Open dokato opened this issue 3 years ago • 1 comments

When I try to assign soma positions to neurolist metadata with xyzmatrix I get only this warning

> xyzmatrix(dps5[,]) <- xyzmatrix(meta)
Warning message:
In matrix(value, n, p) :
  data length [21] is not a sub-multiple or multiple of the number of rows [5]

that results in completely messed up values. See toy data to reproduce.

example.rda.zip

Expected

xyzmatrix recognizes and assigns positions based on rownames of a larger set of neuron body ids from the RHS.

Probably a new xyzmatrix <-matrix` function needed here?

dokato avatar Jun 14 '21 12:06 dokato

Hmm. That is not something I have tried to do in the past. I guess it would be convenient in this scenario, but I wonder if at some point it might be a little fragile. This method will not know that it is a neuronlist attached data.frame, it could be any old data.frame or matrix and we use it a lot in that more general context.

jefferis avatar Jun 15 '21 11:06 jefferis