Skip to content

[Rcpp-devel] Doubt about best pratices

1 message · Jeff Newmiller

#
It is not possible to convert a data frame to a matrix without copying data.

But normally algorithms that need a matrix become noticeably less efficient when applied to data frames. If this is your case, I would simply encourage the user to pass a matrix into your function in the first place. The sooner the right data structure is used, the less gratuitous conversion needs to happen.

I think there is no one answer to this though... what is your algorithm? Would it work well on column vectors?
On April 30, 2022 9:38:49 PM PDT, Roberto Spadim <roberto at spadim.com.br> wrote: