The basic algorithm of robust principal component analyzers is given [here] with S language. This source codes can run also on R.
Furthermore for adaptive selection by K-fold cross validation the S source codes are available on request from one of authors: higuchi amath.hiroshima-u.ac.jp