require(cluster)
# The Ruspini data set from the package "cluster""
x = as.matrix(ruspini)
# assign random weights to observations
w = sample(1:20,nrow(x),replace = TRUE)
#PCA with observational weights
res = Wpca(x, wrow = w)
#weighted principal components
pc = res$x
pc
#loading vectors
loadings = res$rotation
loadings
Run the code above in your browser using DataLab