diff --git a/R/principal_components.R b/R/principal_components.R index f07735929..ecacc0d89 100644 --- a/R/principal_components.R +++ b/R/principal_components.R @@ -422,6 +422,14 @@ principal_components.data.frame <- function(x, } else if (n < 1) { n <- 1 } + + ## TODO: the next if-statement was removed by Dom, but this breaks + ## performance code. Need to check, so we for now add this back + + # sanity check - we need at least two factors + if (n < 2 && ncol(x) >= 2) { + n <- 2 + } n }