ComeçarComece de graça

Summarizing PCA in R

As we saw in the video, there was a categorical variable (position) in our data that seemed to identify itself with clusters in the first two principal components. Even when scaling the data, these two PCs still explain a great deal of variation in the data. What if we looked at only one position at a time?

Este exercício faz parte do curso

Linear Algebra for Data Science in R

Ver curso

Instruções do exercício

Perform the same analysis as in the previous exercise, but only use the subset of the data where position equals "WR" (wide receiver):

  • Use the scale() function to scale the 5th through the 12th columns of combine_WR data. Name this data frame B and show some of the values using head().
  • Use prcomp() to perform principal component analysis on the data and summarize this analysis using summary().

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Subset combine only to "WR"
combine_WR <- subset(combine, position == "WR")

# Scale columns 5-12 of combine_WR
B <- ___(___[, ___])

# Print the first 6 rows of the data
___

# Summarize the principal component analysis
___(___)
Editar e executar o código