LoslegenKostenlos loslegen

Compute a PCA

Now it's your turn: Compute a PCA on the newsData dataset which is already loaded in the workspace and look at the results. The stats package is loaded by default, the package dplyr has already been loaded for you.

Diese Übung ist Teil des Kurses

Machine Learning for Marketing Analytics in R

Kurs anzeigen

Anleitung zur Übung

  • First, standardize all variables in the dataset and save the result again in newsData (it's ok to overwrite the existing newsData object, we won't need it anymore).
  • Compute a PCA and store the results in an object called pcaNews.
  • Examine the results by looking at the eigenvalues. Round them to two digits.

Interaktive Übung

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

# Standardize data
___ <- newsData %>% ___() %>% as.data.frame()

# Compute PCA
___ <- newsData %>% ___()

# Eigenvalues
pcaNews$___ %>% ___()
Code bearbeiten und ausführen