title: R function to print table with stationarity test results
body: <p>I am trying to create an elegant solution that enables to select a set of data and then prints the Augmented Dickey-Fuller test results, as well as their critical values, into a table.</p>
  
  <p>I generated following example code to get the needed data:</p>
  
  <pre><code>library(urca)
  data(Canada)
  Canada
  data.dft &lt;- ur.df(Canada[, "e"], lags=3, type='drift')
  data.df &lt;- ur.df(Canada[, "e"], lags=3, type='trend')
  summary(data.dfc)
  summary(data.dft)
  </code></pre>
  
  <p>Desired output table:</p>
  
  <pre><code>T-test(drift),  1%,    5%,    10%,   T-test(trend),  1%,    5%,    10%
         0.4964   -3.51  -2.89  -2.58         -1.9664  -4.04  -3.45 -3.15
  </code></pre>
  
  <p>Tried:</p>
  
  <pre><code>stationarity = function(df, x){
  for (i in x){
    out1 = ur.df(df.i[,1], type = "drift", selectlags = "BIC")
    out2 = ur.df(df.i[,1], type = "trend", selectlags = "BIC")
    est_df = cbind(out1@teststat[1],
                   out1@cval[1,1],
                   out1@cval[1,2],
                   out1@cval[1,3],
                   out2@teststat[1],
                   out2@cval[1,1],
                   out2@cval[1,2],
                   out2@cval[1,3])
    print(est_df)
  }
  }
  
  stationarity(Canada, c("e","prod","RW"))
  </code></pre>
  
  <p>However, that didn't work:</p>
  
  <blockquote>
    <p>" Error in as.matrix(y) : object 'df.i' not found ".</p>
  </blockquote>
  
  <p><strong>Any idea how to write the function correctly, or even improve it?</strong> If possible, I would directly like to add corresponding results for the <code>ur.pp</code> test. <code>dplyr</code> solutions welcome.</p>