コード
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
subset(df_zoo, select = c(body_length_cm, weight_kg)) |>
::filter(!is.na(body_length_cm)) |>
dplyrprcomp(scale. = TRUE)
Standard deviations (1, .., p=2):
[1] 1.3577273 0.3956975
Rotation (n x k) = (2 x 2):
PC1 PC2
body_length_cm 0.7071068 -0.7071068
weight_kg 0.7071068 0.7071068