As a summary exercise:
a. Build an R function that takes as input a (T,p) matrix representing the output of an MCMC run with T iterations and p components and that produces as its output p spreadsheets (one for every component) made of raw plots, density estimates, autocorrelation functions, Kolmogorov-Smirnov tests, Geweke's plots, and outcomes of cumuplot on a single page.
b. Parameterize the function such that those spreadsheets are automatically saved in an open format (pdf, eps, jpg, etc.).