Skip to content

Commit

Permalink
Merge branch 'main' into n_factors_add_varex
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke authored Dec 1, 2023
2 parents 6f6adf8 + 242610b commit e0ad439
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ skip_if_not_installed("nFactors")
skip_if_not_installed("GPArotation")

test_that("principal_components", {
x <- parameters::principal_components(mtcars[, 1:7], rotation = "varimax")
x <- principal_components(mtcars[, 1:7], rotation = "varimax")

expect_equal(
x$RC1,
Expand All @@ -22,7 +22,7 @@ test_that("principal_components", {
expect_named(x, c("Variable", "RC1", "RC2", "Complexity", "Uniqueness", "MSA"))

expect_identical(dim(predict(x)), c(32L, 2L))
expect_named(predict(x, names=c("A", "B")), c("A", "B"))
expect_named(predict(x, names = c("A", "B")), c("A", "B"))
expect_identical(nrow(predict(x, newdata = mtcars[1:3, 1:7])), 3L)
})

Expand Down Expand Up @@ -58,7 +58,7 @@ test_that("principal_components", {
})

test_that("principal_components", {
x <- model_parameters(principal(mtcars[, 1:7], nfactors = 2))
x <- model_parameters(principal_components(mtcars[, 1:7], nfactors = 2))
expect_equal(
x$RC1,
c(
Expand All @@ -75,7 +75,7 @@ test_that("principal_components", {

expect_named(x, c("Variable", "RC1", "RC2", "Complexity", "Uniqueness"))
expect_identical(dim(suppressWarnings(predict(x))), c(32L, 2L))
expect_identical(dim(suppressWarnings(predict(x, newdata=mtcars[1:3, 1:7]))), c(3L, 2L))
expect_identical(dim(suppressWarnings(predict(x, newdata = mtcars[1:3, 1:7]))), c(3L, 2L))
})


Expand Down

0 comments on commit e0ad439

Please sign in to comment.