const pc = prcomp([[1, 2], [2, 1], [3, 4], [4, 3]]);
pc.sdev; // [1.632993161855452, 0.816496580927726]
pc.x; // [[-1.4142, 0.7071], [-1.4142, -0.7071], [1.4142, 0.7071], [1.4142, -0.7071]] (signs may differ from R)
prcomp([[1, 2], [2, 1], [3, 4], [4, 3]], { rank: 1 }).rotation.length; // 2 (variables; one column each)
xの列の主成分です (観測を行とします)。R のprcomp()と同等です。各成分の符号は、R と同じく任意です。