Rdimtools
Rdimtools copied to clipboard
d should be allowed to equal p.
do.pca() still doesn't allow d to be equal to p which is fully valid. It currently silently drops a dimension.
dat <- mtcars[, 1:2]
Rdimtools::do.pca(X = as.matrix(dat), ndim = 2)
#> $Y
#> [,1]
#> [1,] -18.831637
#> [2,] -18.831637
#> [3,] -21.074684
#> [4,] -19.218921
#> [5,] -16.104483
#> [6,] -16.023824
#> [7,] -11.844353
#> [8,] -22.623822
#> [9,] -21.074684
#> [10,] -17.088856
#> [11,] -15.733360
#> [12,] -13.877597
#> [13,] -14.748987
#> [14,] -12.715744
#> [15,] -8.068329
#> [16,] -8.068329
#> [17,] -12.231638
#> [18,] -30.369513
#> [19,] -28.433090
#> [20,] -31.821830
#> [21,] -19.816009
#> [22,] -13.006207
#> [23,] -12.715744
#> [24,] -10.876142
#> [25,] -16.588589
#> [26,] -25.431635
#> [27,] -24.172960
#> [28,] -28.433090
#> [29,] -13.296670
#> [30,] -17.572962
#> [31,] -12.522101
#> [32,] -19.719188
#>
#> $vars
#> [1] 38.69375
#>
#> $projection
#> [,1]
#> [1,] -0.9682113
#> [2,] 0.2501336
#>
#> $algorithm
#> [1] "linear:PCA"
#>
#> attr(,"class")
#> [1] "Rdimtools"
Created on 2023-03-20 with reprex v2.0.2