malcook
malcook

Reputation: 1723

Access columns of an R data.table as a matrix, by reference

I recall there is a special (undocumented?) form that allows accessing selected columns of a data.table by reference as a matrix (in so doing allocating no memory) but for the life of me I can't find my note on the subject. Something analogous to setDF, but yielding a matrix, not a data.frame. I understand this might come with certain dangers, and would like to be reminded of how to do this, and what the dangers are.

Upvotes: 0

Views: 77

Answers (1)

jangorecki
jangorecki

Reputation: 16697

It is not possible, because matrix has different layout in memory than list/data.frame/data.table, and we don't have any mapping that allows that.

Upvotes: 1

Related Questions