LoslegenKostenlos loslegen

Scaling Data Before PCA

When dealing with data that has features with different scales, it's often important to scale the data first. This is because data that has larger values may sway the data even with relatively little variability.

The combine data frame is loaded for you.

Diese Übung ist Teil des Kurses

Linear Algebra for Data Science in R

Kurs anzeigen

Anleitung zur Übung

  • Use the scale() function to scale the 5th through the 12th columns of combine 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().

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

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

# Print the first 6 rows of the data
___

# Summarize the principal component analysis
summary(____(B))
Code bearbeiten und ausführen