title: Converting a tbl_df to a ts
body: <p>I am trying to convert a tbl_df to a ts time-series in R. Below is the head() of my data frame:</p>
  
  <pre><code>    head(Investment)
  # A tibble: 6 x 9
    TIME_PERIOD GPDI_Chained LogGPDI CorpTaxX Baseline_Uncertainty  gGDP PCE_Defl ofPagesFedReg logabsgGDP
    &lt;chr&gt;              &lt;dbl&gt;   &lt;dbl&gt;    &lt;dbl&gt;                &lt;dbl&gt; &lt;dbl&gt;    &lt;dbl&gt;         &lt;dbl&gt;      &lt;dbl&gt;
  1 1985 Q1            1122.    3.05     20.2                 112.   3.9     1.82         50502      0.591
  2 1985 Q2            1141.    3.06     19.8                 119.   3.6     1.75         50502      0.556
  3 1985 Q3            1134.    3.05     20.6                 127.   6.2     1.77         50502      0.792
  4 1985 Q4            1176.    3.07     20.1                 124.   3       1.82         50502      0.477
  5 1986 Q1            1175.    3.07     23.8                 159.   3.8     1.60         44812      0.580
  6 1986 Q2            1155.    3.06     24.3                 135.   1.8     1.12         44812      0.255
  </code></pre>
  
  <p>I have tried to coerce the Tibble into a ts by using the following:</p>
  
  <pre><code>&gt; DF &lt;- read.table("file_path", header=TRUE, sep=",", row.names=NULL)
  &gt; InvestmentTS&lt;-as.ts(DF)
  </code></pre>
  
  <p>which yields:</p>
  
  <pre><code>&gt; head(InvestmentTS)
       TIME_PERIOD GPDI_Chained  LogGPDI CorpTaxX Baseline_Uncertainty gGDP PCE_Defl ofPagesFedReg logabsgGDP
  [1,]           1       1122.3 3.050109 20.23836             112.1454  3.9    1.818         50502  0.5910646
  [2,]           2       1141.4 3.057438 19.78908             118.5357  3.6    1.751         50502  0.5563025
  [3,]           3       1133.7 3.054498 20.64556             127.1788  6.2    1.770         50502  0.7923917
  [4,]           4       1175.5 3.070223 20.05952             123.7795  3.0    1.825         50502  0.4771213
  [5,]           5       1175.1 3.070075 23.80535             158.5329  3.8    1.597         44812  0.5797836
  [6,]           6       1154.6 3.062432 24.26877             135.1720  1.8    1.115         44812  0.2552725
  </code></pre>
  
  <p>The problem here is that I have lost my "year-quarter" column (<code>TIME_PERIOD</code>).
  Now I have also tried to convert the TIME_PERIOD column into a yearqtr using:</p>
  
  <pre><code>quarter&lt;-c("1985-1" , ... , "2018-3")
  &gt; as.yearqtr(format(quarter), "%Y-%q")
  </code></pre>
  
  <p>Which is successful, however, I don't know how to implement this into the ts so that the TIME_PERIOD column has the year_quarter dates instead of ordinal numbers.</p>
  
  <p>Would someone be able to help explain how to convert the tbl_df to ts so that it shows the dates from the TIME_PERIOD column?</p>
  
  <p>I apologize in advance if this has been answered elsewhere or if its an overly simple answer, I am just learning R and only need this data-frame to be ts so I can run some diagnostic tests for my time-series regression model which apparently require data to be ts.</p>
  
  <p>Thanks in advance.</p>