Using the princomp function
In this exercise you will use the princomp() function to calculate the principal components (PCs) of a dataset. We will use the pca.state object created in this exercise throughout the rest of this chapter.
本练习是课程的一部分
Multivariate Probability Distributions in R
练习说明
- Calculate the principal components, and the scores of the PCs, of the
state.x77dataset based on the correlation matrix and store it aspca.state. - Provide a plot and print the summary of the principal component object.
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Calculate PCs
pca.state <- princomp(___, cor = ___, scores = ___)
# Plot the PCA object
plot(___)
# Print the summary of the PCs
summary(___)