Re: [R] Potential bug/unexpected behaviour in model matrix

2021-08-26 Thread Andrew Simmons
Hello, I'm not so sure this is a bug, it appears to be behaving as intended from the documentation. I would suggest using argument 'physical' from 'setkey' to avoid reordering the rows. Something like: x <- data.table::data.table(V1 = 9:0) y <- data.table::copy(x) data.table::setkey(x, V1, ph

[R] Potential bug/unexpected behaviour in model matrix

2021-08-26 Thread Leonidas Lundell
Dear R-project, Apologies if I am sending this to the wrong list, and thank you for your enormous contribution. I discovered a subtle interaction between the data.table package and model.matrix function that influences the output to the point that you will get completely erroneous results: d