title: Principal component analysis (PCA) of time series data: spatial and temporal pattern
body: <p>Suppose I have yearly precipitation data for 100 stations from 1951 to 1980. In some papers, I find people apply PCA to the time series and then plot the spatial loadings map (with values from -1 to 1), and also plot the time series of the PCs. For  example, figure 6 in <a href="https://publicaciones.unirioja.es/ojs/index.php/cig/article/view/2931/2696" rel="noreferrer">https://publicaciones.unirioja.es/ojs/index.php/cig/article/view/2931/2696</a> is the spatial distribution of the PCs.</p>
  
  <p>I am using function <code>prcomp</code> in R and I wonder how I can do the same thing. In other words, how can I extract the "spatial pattern" and "temporal pattern" from the results of <code>prcomp</code> function? Thanks.</p>
  
  <pre><code>set.seed(1234)
  rainfall = sample(x=100:1000,size = 100*30,replace = T)
  rainfall=matrix(rainfall,nrow=100)
  colnames(rainfall)=1951:1980
  PCA = prcomp(rainfall,retx=T)
  </code></pre>
  
  <p>Or, there are real data at <a href="https://1drv.ms/u/s!AnVl_zW00EHegxAprS4s7PDaYQVr" rel="noreferrer">https://1drv.ms/u/s!AnVl_zW00EHegxAprS4s7PDaYQVr</a></p>