[datatable-help] possible FR: let as.matrix.data.table automatically grab a column named "rn"

Frank Erickson FErickson at psu.edu
Fri Oct 18 19:03:57 CEST 2013


In trying to come up with a simple answer here
http://stackoverflow.com/a/19454986/1191259

...I found myself doing something like this:

adj1mat           <- as.matrix(adj1[,-1,with=FALSE])
rownames(adj1mat) <- as.character(adj1$rn)

which is awkward. It would be nice if as.matrix.data.table could invert
keep.rownames=TRUE from as.data.table.* (for data.frames or matrices) by
putting the rownames in place. If that were the case, I could just write...

adj1mat           <- as.matrix(adj1)

I see in getAnywhere(as.matrix.data.table), that it currently always
assigns NULL rownames. Anyway, it's a minor suggestion.

--Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20131018/8847a1ef/attachment.html>


More information about the datatable-help mailing list