# simulate data
n <- 500
p <- 5000
Y <- Rfast::matrnorm(n, p, seed = 1)
# SVD
dcmp <- svd(Y)
# how many components to retain
sv_threshold(n, p, dcmp$d)
# in this case the data has no structure, so no components are retained
Run the code above in your browser using DataLab