Skip to content
Prev 43404 / 63421 Next

prcomp with previously scaled data: predict with 'newdata' wrong

To fix myself: the stupid solution I suggested won't work as 'scale.' need not be TRUE or FALSE, but it can be a vector of scales. The following looks like being able to handle this, but is not transparent nor elegant:

sc <- if (isTRUE(scale.)) attr(x, "scaled:scale") else scale.

I trust you find an elegant solution (if you think this is worth fixing).

Cheers, Jari Oksanen

PS. Sorry for the top posting: cannot help with the email system I have in my work desktop.