title: Autocorrelation create time series object with multi dimension with many levels
body: <p>(added xts and zoo tags since I couldn't see a specific r based time-series tag)</p>
  
  <p>I was researching the concept of time lag and correlation and learned about the acf() function that calculates the correlation of a variable lagged on itself by different time indexes.</p>
  
  <p>I have a data frame with a numeric variable of interest along with a date field. Using dplyr::group_by I was able to group data by date, create a time series object and calculate <code>acf()</code>:</p>
  
  <pre><code>&gt; str(example_data)
  An ‘xts’ object on 2016-08-06/2016-12-31 containing:
    Data: num [1:135, 1] 314.2 166.2 99.8 167 141.4 ...
    Indexed by objects of class: [Date] TZ: UTC
    xts Attributes:  
   NULL
  &gt; 
  
  acf(example_data, lag.max = 5, plot = F)    
  Autocorrelations of series ‘ts_pdata’, by lag    
      0     1     2     3     4     5 
  1.000 0.436 0.228 0.216 0.325 0.430 
  </code></pre>
  
  <p>So far so good.
  These correlations don't appear very strong and I wanted to explore my data more to see if any particular segments do have a stronger autocorrelation.</p>
  
  <p>My original data frame has many features. Here's a glimpse:</p>
  
  <pre><code>&gt; glimpse(pdata)
  Observations: 48,084
  Variables: 14
  $ notid                   &lt;chr&gt; "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"...
  $ ADR                     &lt;dbl&gt; 71.0600, 76.5600, 153.8800, 126.6000, 115.0800, 81.6000, 77.1600, 168.360...
  $ hotel_id                &lt;dbl&gt; 297388, 298322, 2313076, 2240838, 2240838, 331350, 782884, 2313076, 23252...
  $ city_id                 &lt;dbl&gt; 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9395, 9...
  $ star_rating             &lt;dbl&gt; 2.5, 3.0, 5.0, 3.5, 3.5, 3.0, 3.0, 5.0, 2.0, 3.0, 4.0, 2.0, 3.0, 2.0, 3.0...
  $ accommodation_type_name &lt;chr&gt; "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "...
  $ chain_hotel             &lt;chr&gt; "non-chain", "non-chain", "chain", "non-chain", "non-chain", "non-chain",...
  $ booking_date            &lt;date&gt; 2016-08-02, 2016-08-02, 2016-08-02, 2016-08-04, 2016-08-04, 2016-08-04, ...
  $ checkin_date            &lt;date&gt; 2016-10-01, 2016-10-01, 2016-10-01, 2016-10-02, 2016-10-02, 2016-10-03, ...
  $ checkout_date           &lt;date&gt; 2016-10-02, 2016-10-02, 2016-10-02, 2016-10-03, 2016-10-03, 2016-10-05, ...
  $ city                    &lt;chr&gt; "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"...
  </code></pre>
  
  <p>Of particular interest are:</p>
  
  <pre><code>unique(example_data$accommodation_type_name)
   [1] "Hotel"                         "Serviced Apartment"            "Hostel"                       
   [4] "Guest House / Bed &amp; Breakfast" "Motel"                         "Apartment"                    
   [7] "Resort"                        "Ryokan"                        "Resort Villa"                 
  [10] "Private Villa"                 "Bungalow"                      "Villa"                        
  [13] "Holiday Park / Caravan Park"   "Capsule Hotel"                 "Love Hotel"                   
  [16] "Home"            
  
  unique(example_data$star_rating)
   [1] 2.5 3.0 5.0 3.5 2.0 4.0 4.5 1.5 0.0 1.0
  </code></pre>
  
  <p>Other variables might be worth exploring too. I could just create a new data frame for each segment, convert to time series and then calculate <code>acf()</code> e.g. for Hotels in city A with 4 star rating:</p>
  
  <pre><code>ts_pdata &lt;- example_data %&gt;% filter(star_rating == 4, accommodation_type_name == "Hotel") %&gt;%
    group_by(booking_date) %&gt;% 
    summarize(Avg_ADR = mean(ADR)) %&gt;% 
    arrange(booking_date)
  
  ts_pdata &lt;- xts(ts_pdata$Avg_ADR, ts_pdata$booking_date)
  acf(ts_pdata, lag.max = 5)
  </code></pre>
  
  <p>I wondered if there was a more efficient way of doing this. In other words, if I wanted to explore auto correlation using <code>acf()</code> along each unique combination of star rating and city, is there a more sophisticated solution that creating a new filtered time series object for each breakdown?</p>
  
  <p>Here are some example data:</p>
  
  <pre><code>example_data: &lt;- structure(list(booking_date = structure(c(17102, 17127, 17125, 
  17019, 17074, 17150, 17098, 17130, 17153, 17089, 17082, 17081, 
  17074, 17075, 17095, 17159, 17121, 17110, 17081, 17164, 17054, 
  17149, 17076, 17129, 17125, 17080, 17128, 17141, 17099, 17132, 
  17136, 17153, 17104, 17120, 17122, 17146, 17094, 17113, 17072, 
  17072, 17121, 17041, 17120, 17082, 17132, 17076, 17115, 17082, 
  17097, 17124, 17102, 17117, 17097, 17112, 17083, 17097, 17130, 
  17077, 17130, 17107, 17151, 17041, 17116, 17076, 17155, 17122, 
  17100, 17159, 17077, 17074, 17160, 17123, 17038, 17073, 17088, 
  17038, 17102, 17068, 17157, 17097, 17142, 17072, 17125, 17085, 
  17149, 17163, 17123, 17144, 17127, 17138, 17141, 17042, 17127, 
  17061, 17079, 17116, 17141, 17076, 17122, 17045, 17120, 17103, 
  17056, 17055, 17110, 17115, 17077, 17084, 17098, 17150, 17096, 
  17099, 17058, 17041, 17072, 17131, 17077, 17130, 17096, 17089, 
  17065, 17104, 17112, 17139, 17049, 17066, 17129, 17156, 17098, 
  17106, 17080, 17074, 17109, 17122, 17125, 17079, 17072, 17151, 
  17076, 17079, 17107, 17159, 17118, 17083, 17149, 17164, 17146, 
  17104, 17064, 17101, 17113, 17086, 17119, 17132, 17117, 17130, 
  17118, 17126, 17113, 17107, 17069, 17146, 17065, 17107, 17158, 
  17093, 17154, 17149, 17154, 17073, 17072, 17142, 17093, 17093, 
  17087, 17122, 17038, 17086, 17156, 17088, 17091, 17135, 17075, 
  17047, 17054, 17160, 17141, 17102, 17095, 17097, 17094, 17137, 
  17078, 17046, 17126, 17139, 17092, 17118, 17134, 17092, 17124, 
  17083, 17138, 17077, 17123, 17149, 17077, 17154, 17150, 17081, 
  17133, 17160, 17035, 17163, 17101, 17127, 17082, 17156, 17131, 
  17099, 17125, 17069, 17086, 17108, 17074, 17131, 17082, 17088, 
  17133, 17038, 17098, 17141, 17132, 17143, 17137, 17130, 17081, 
  17150, 17123, 17073, 17102, 17153, 17062, 17150, 17090, 17127, 
  17135, 17066, 17108, 17141, 17119, 17073, 17125, 17077, 17125, 
  17059, 17080, 17037, 17062, 17142, 17150, 17098, 17119, 17092, 
  17067, 17137, 17095, 17146, 17150, 17104, 17110, 17058, 17126, 
  17089, 17101, 17099, 17160, 17086, 17085, 17092, 17091, 17140, 
  17134, 17041, 17100, 17095, 17086, 17114, 17136, 17079, 17044, 
  17074, 17073, 17064, 17122, 17108, 17142, 17134, 17122, 17109, 
  17112, 17065, 17135, 17057, 17141, 17144, 17148, 17111, 17079, 
  17102, 17061, 17100, 17110, 17118, 17141, 17110, 17030, 17132, 
  17107, 17099, 17147, 17109, 17110, 17120, 17129, 17067, 17076, 
  17111, 17103, 17076, 17158, 17106, 17083, 17136, 17132, 17119, 
  17126, 17070, 17135, 17140, 17162, 17041, 17043, 17129, 17103, 
  17037, 17119, 17144, 17101, 17076, 17077, 17096, 17080, 17079, 
  17101, 17057, 17121, 17093, 17069, 17136, 17082, 17111, 17042, 
  17126, 17088, 17166, 17078, 17086, 17096, 17074, 17120, 17085, 
  17117, 17144, 17096, 17106, 17100, 17090, 17098, 17079, 17122, 
  17159, 17099, 17137, 17096, 17062, 17073, 17127, 17108, 17104, 
  17080, 17122, 17156, 17133, 17053, 17132, 17110, 17144, 17135, 
  17144, 17101, 17149, 17147, 17114, 17063, 17119, 17094, 17121, 
  17081, 17034, 17126, 17123, 17090, 17080, 17089, 17074, 17153, 
  17132, 17086, 17125, 17063, 17138, 17071, 17134, 17143, 17140, 
  17133, 17164, 17083, 17149, 17154, 17083, 17074, 17157, 17089, 
  17076, 17077, 17144, 17078, 17033, 17112, 17079, 17103, 17071, 
  17096, 17124, 17060, 17075, 17126, 17146, 17092, 17116, 17151, 
  17088, 17087, 17076, 17084, 17081, 17106, 17089, 17118, 17077, 
  17145, 17122, 17135, 17091, 17091, 17102, 17114, 17147, 17089, 
  17127, 17100, 17151, 17095, 17131, 17075, 17135, 17149, 17086, 
  17142, 17163, 17075, 17121, 17122, 17084, 17097, 17115, 17074, 
  17074, 17084, 17105, 17100, 17036, 17123, 17081, 17080, 17092, 
  17156, 17118), class = "Date"), ADR = c(68.4, 222.23, 132.88, 
  205.3066667, 363.21, 14.28, 84.52, 36.86, 49.12, 135.76, 82.44, 
  490.5666667, 118.26, 115.58, 251.2, 73.18, 28.21, 55.4, 192.3, 
  42.44, 80.3, 57.32, 51.69, 158.82, 100.98, 194.72, 156, 170.72, 
  366, 39.2, 110.55, 50.56, 35.5, 49.84, 42.02, 151.62, 90.34, 
  88.28, 74.12, 55.26, 41.56, 172.47, 38.74, 62.22, 60, 80.22, 
  59.08, 207.42, 41.2, 220.5, 106.74, 36.16, 16.56, 245.68, 154.6666667, 
  110.26, 50.88, 219.56, 108.46, 47.06, 53.6, 62.8, 415.16, 435.42, 
  38.34, 71.28, 160.62, 197.02, 132.03, 82.24, 109.1, 493.84, 127.42, 
  204, 38.98, 240.56, 61.17333333, 185.73, 165.5, 52.24, 84.8, 
  154.74, 345.88, 216.2133333, 84, 127.58, 128.52, 316.4, 68.38, 
  57.26, 145, 176.9, 121, 99.94, 52.96, 194.98, 220, 145.82, 70.68, 
  292.32, 44.2, 128.65, 389.44, 229.94, 37.4, 45.3, 342.3, 39.4, 
  195.18, 49.59333333, 252.04, 128.62, 74.66, 143.1, 109.22, 108.39, 
  108.08, 332.48, 59.86, 43.84, 181.86, 76.02, 286.8, 25.36, 55.3, 
  191.08, 188.68, 181.52, 51.1, 63.94, 183.6, 117.42, 160.72, 37.46, 
  95.56, 135.92, 160.9, 122.04, 53.28, 191.06, 103.16, 76, 67.82, 
  186.12, 163.2, 218.08, 83.08, 78.6, 368.24, 115.2, 58.36, 53.84, 
  272.2666667, 44.66, 85.98, 37.34, 64.01, 125.69, 33.24, 49, 243.2666667, 
  92.48, 74.24, 103.07, 191.98, 74.88, 83.72, 118.08, 31.02, 102.98, 
  45.2, 50.53, 130.42, 322.3666667, 105.06, 206.9, 62.88, 51.48, 
  158.6, 65.02666667, 444.2066667, 53, 36.98, 103.2, 143.48, 44.48, 
  280.06, 55.9, 231.56, 73.28, 108.98, 137.96, 214.4, 232.87, 154.18, 
  77.36, 204.1466667, 68.68, 153.16, 220.98, 242.47, 68, 63.4, 
  189.4, 118.4, 443.02, 269.8, 420.64, 167.2, 311.6, 52.52, 31.36, 
  124.96, 269.32, 23.94, 90.34, 57.3, 68.6, 166.82, 73.18, 116.02, 
  117.44, 36.08, 137.38, 55.4, 203.6066667, 337.92, 188.77, 90.98, 
  61.62, 134.11, 37.46, 65.38, 82, 48.6, 45.08, 149.32, 24.5, 56.06, 
  122.1, 33.08, 211.08, 61.06, 84.34, 85.52, 49.53, 74.73, 111.43, 
  36.62, 78.06, 31.58, 253.9, 90.36, 33.8, 51.56, 95.96, 182.9266667, 
  70.72, 132.54, 29.36, 219.46, 50.02, 90.3, 219.22, 54.06, 110.2, 
  67.38, 86.43333333, 51.82, 75.62, 260.72, 124.78, 142.68, 180.86, 
  98.74, 119.8733333, 48.48, 107.24, 163.44, 53.4, 86.15, 42.9, 
  57, 256.3933333, 171.2, 80.94, 40.48, 448.96, 83.42, 284.46, 
  67.84, 183.26, 222.44, 180.6, 162.68, 260.46, 54.22, 176, 102.6733333, 
  88.5, 83.86, 268.06, 207.58, 158.46, 38.58, 39.16, 36.28, 169.6933333, 
  190.1, 72.46, 73.66, 44.18, 107.8, 255.2, 124.02, 68.88, 251.42, 
  50.02, 207, 57.56, 224.52, 133.24, 252.84, 89.54, 66.62, 165.76, 
  61.42, 224.76, 160.38, 69.36, 117.66, 232.96, 104.98, 47.12, 
  42.68, 28.18, 33.34, 130.3, 247.64, 118, 238.9533333, 215.96, 
  57.72, 55.46, 113.82, 193.0666667, 79.16, 123.34, 225.9733333, 
  111.36, 265.26, 170.14, 135.26, 212.92, 146.15, 185.56, 380.7466667, 
  114.82, 74.04, 49.46, 146.94, 282.88, 97.12666667, 98.82, 110.38, 
  407.54, 56.24, 64.18, 66, 59.67333333, 185.5, 222.5266667, 93.66, 
  291.32, 212.44, 216.38, 76.18666667, 131.76, 394.4, 160.92, 118.32, 
  63.58, 164.34, 249.04, 77.66, 303.14, 437.44, 24.02, 22.9, 267.9133333, 
  95.46, 236.68, 323.28, 156.5, 100.52, 101.7, 289.32, 392.28, 
  254.76, 56, 68.44, 179.52, 203.86, 67.66, 107.7, 216.02, 74.5, 
  51.08, 77.2, 58.41333333, 112.12, 76, 29.12, 224.5866667, 53.08, 
  195.37, 310, 76.28, 57.82, 275.1333333, 229.76, 124.44, 83.24, 
  200.08, 101.86, 351.9066667, 152.57, 38.54, 78.84, 15.46, 87.92, 
  35.2, 328, 35.54, 149.54, 98.36, 116.04, 204.34, 117.9, 58.41333333, 
  104.86, 202.9866667, 200.48, 421.65, 85.38, 67.29333333, 294.7533333, 
  164.28, 150.4, 86.80666667, 197.83, 213.52, 121.92, 46.50666667, 
  68.17, 373.78, 131.62, 127.36, 111.28, 276.92, 36.48, 171.03, 
  100.54, 380.8066667, 131.34, 57.6, 131.12, 332.4533333, 38.84, 
  78, 44.5, 37.38, 62, 71.6, 167.3, 50.5, 128.29, 310.19, 258.4, 
  72.17, 77.32, 168.2, 116.04, 34.28, 41.04, 193.96, 66, 171.47, 
  46.7, 127.66, 81.6, 453.88, 104.34, 121.62, 81.83, 129.4, 179.0066667, 
  210.42, 95.49, 36.72), city = c("C", "E", "A", "C", "D", "A", 
  "A", "E", "A", "D", "A", "C", "A", "A", "D", "E", "E", "A", "A", 
  "A", "B", "B", "D", "C", "C", "D", "D", "D", "D", "E", "B", "A", 
  "D", "A", "A", "A", "A", "A", "A", "A", "C", "D", "A", "C", "A", 
  "E", "A", "C", "A", "A", "D", "A", "B", "E", "D", "A", "E", "E", 
  "A", "A", "B", "C", "D", "B", "A", "E", "B", "D", "A", "A", "E", 
  "A", "B", "C", "A", "D", "B", "D", "A", "A", "A", "D", "D", "D", 
  "A", "D", "B", "D", "A", "A", "A", "D", "A", "A", "C", "E", "D", 
  "D", "D", "D", "A", "D", "D", "D", "A", "A", "C", "A", "D", "A", 
  "A", "D", "A", "A", "A", "A", "A", "A", "C", "C", "D", "C", "D", 
  "A", "C", "D", "C", "A", "B", "A", "E", "E", "C", "A", "E", "A", 
  "D", "A", "A", "D", "D", "A", "A", "D", "D", "A", "A", "A", "A", 
  "A", "A", "A", "D", "A", "E", "E", "C", "D", "D", "E", "A", "A", 
  "E", "A", "A", "C", "A", "A", "A", "A", "C", "E", "A", "C", "A", 
  "D", "E", "A", "D", "A", "D", "A", "A", "A", "C", "E", "D", "E", 
  "E", "E", "A", "D", "A", "C", "D", "E", "D", "B", "D", "E", "D", 
  "E", "A", "C", "A", "A", "C", "D", "B", "D", "A", "A", "E", "D", 
  "A", "A", "D", "A", "D", "A", "D", "E", "D", "A", "A", "C", "C", 
  "D", "E", "E", "A", "C", "A", "D", "A", "A", "A", "E", "B", "E", 
  "D", "A", "A", "D", "D", "A", "A", "D", "A", "A", "A", "D", "D", 
  "D", "A", "A", "D", "A", "B", "A", "D", "A", "E", "A", "A", "D", 
  "A", "A", "B", "A", "E", "C", "D", "C", "A", "A", "A", "A", "A", 
  "D", "D", "A", "A", "D", "A", "A", "A", "D", "E", "E", "A", "D", 
  "D", "A", "D", "D", "E", "D", "C", "A", "A", "C", "C", "D", "A", 
  "A", "A", "D", "D", "B", "A", "A", "A", "D", "C", "A", "C", "A", 
  "C", "A", "D", "A", "C", "E", "A", "A", "A", "C", "D", "A", "A", 
  "B", "B", "C", "B", "B", "D", "A", "D", "A", "A", "C", "A", "E", 
  "A", "C", "B", "C", "C", "D", "A", "D", "A", "C", "C", "C", "D", 
  "D", "A", "A", "A", "D", "A", "E", "E", "D", "A", "B", "A", "D", 
  "C", "D", "A", "D", "B", "E", "C", "A", "A", "E", "A", "B", "A", 
  "B", "E", "D", "C", "A", "A", "A", "A", "C", "A", "D", "A", "A", 
  "D", "C", "D", "A", "B", "C", "A", "A", "C", "B", "C", "D", "B", 
  "A", "A", "A", "B", "D", "A", "C", "E", "A", "A", "D", "C", "D", 
  "A", "C", "A", "C", "A", "A", "A", "B", "A", "E", "A", "A", "C", 
  "A", "D", "D", "C", "A", "D", "C", "C", "C", "A", "B", "D", "D", 
  "A", "B", "D", "A", "A", "A", "A", "C", "B", "D", "A", "C", "A", 
  "A", "E", "D", "E", "A", "D", "D", "A", "C", "E", "A", "B", "A", 
  "C", "A", "D", "C", "C", "A", "A", "D", "D", "A", "C", "D", "A", 
  "D", "B", "D", "A", "D", "A", "A", "A", "A", "A", "C", "B", "A"
  ), star_rating = c(1.5, 5, 4, 3, 4, 2, 3, 3, 2, 3, 3, 5, 4.5, 
  4, 4, 2, 0, 3.5, 5, 3.5, 3, 3, 1, 3, 3, 3, 3, 4, 3, 3, 4, 3, 
  1, 3.5, 3.5, 4, 3, 2.5, 2.5, 3.5, 1, 4, 3.5, 1, 3, 2, 3.5, 3.5, 
  3.5, 5, 4, 3, 2, 4, 3, 4, 3, 5, 4, 2, 3, 1, 3, 3, 3.5, 2, 4, 
  4, 4.5, 3, 4, 5, 4, 3, 3.5, 3, 3, 3, 4, 3.5, 4, 1, 4, 4, 4, 3, 
  5, 4, 4, 3.5, 4, 4, 4, 4, 1, 5, 4, 3, 1, 3, 3.5, 3, 4, 4, 3.5, 
  3.5, 3, 3.5, 3, 3.5, 4.5, 1, 4, 5, 3, 3, 3, 5, 1, 1.5, 3, 1.5, 
  3, 2, 1, 3, 3, 4, 2, 3, 4, 4, 3, 3.5, 3.5, 5, 3, 4, 3, 3, 3, 
  3.5, 4, 3, 3, 4, 3.5, 2.5, 5, 2.5, 2.5, 3.5, 4, 3.5, 3.5, 3, 
  1.5, 1, 1, 2, 5, 4, 3, 4.5, 4, 1, 2.5, 4, 2.5, 4, 3, 3, 3.5, 
  4, 3.5, 3, 3, 2.5, 3, 3, 4, 3, 3, 4, 3, 2, 4, 2, 4, 3, 4, 4, 
  4, 3, 4, 2, 3, 4, 4, 5, 3, 3, 3, 3, 4, 5, 3, 4, 5, 4, 3.5, 3, 
  4, 4, 2.5, 4, 1, 3.5, 4, 2.5, 1, 3, 1, 5, 3, 3, 3, 4, 4, 3, 5, 
  3, 3, 1, 3.5, 3.5, 4, 2.5, 3, 3, 1, 5, 3, 3, 1, 3.5, 3.5, 1, 
  3, 2.5, 2.5, 4, 3, 1, 3.5, 4, 3, 3, 3, 2, 3, 3.5, 4, 4, 3.5, 
  1, 3, 3, 3, 4, 5, 3, 4, 3, 4, 4, 3, 4, 5, 1, 1, 3.5, 3.5, 3, 
  4, 3, 3.5, 4, 3, 3, 3, 4, 3, 4, 4, 3, 2.5, 3, 3, 4, 4, 3.5, 3, 
  4, 3.5, 2, 3.5, 4, 3, 4, 3, 3.5, 4, 4, 3.5, 4, 3.5, 3.5, 3, 3, 
  3, 4.5, 3.5, 4, 3, 5, 3.5, 3, 4, 2.5, 4, 4, 4, 1, 1, 2, 1, 4.5, 
  4, 4, 4, 3, 2.5, 4, 4, 3, 4, 3.5, 3, 3, 3, 4, 4, 3, 3, 3, 4, 
  1, 2.5, 2.5, 5, 3, 3, 4, 3, 1, 3.5, 3.5, 3.5, 1, 3, 3, 3, 3, 
  4, 3, 1.5, 5, 4, 4, 4, 3, 4, 4, 4, 4, 5, 1.5, 0, 5, 3, 3, 4, 
  4, 3, 4, 4, 3, 3, 3, 4, 3, 5, 3, 1.5, 5, 1, 1, 2, 3, 4, 3, 2, 
  4, 3.5, 3, 5, 3, 2, 3, 3.5, 3, 3.5, 3, 4, 3, 5, 2, 3, 0, 4, 2.5, 
  5, 2.5, 3, 4.5, 3, 4, 2, 3, 1, 3.5, 3, 4, 3.5, 1, 4, 3, 5, 4, 
  3, 5, 3, 3.5, 4, 3.5, 3, 4, 4, 3, 3.5, 4, 4, 4, 4, 3.5, 4, 3, 
  3.5, 1, 4, 3.5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3.5, 1, 4, 3.5, 
  3, 3, 3, 3, 4, 4, 4, 3, 4.5, 4, 3, 3, 3.5), accommodation_type_name = c("Hostel", 
  "Resort", "Hotel", "Hotel", "Hotel", "Hostel", "Hotel", "Hotel", 
  "Hostel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", "Hotel", 
  "Resort", "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Capsule Hotel", "Hotel", 
  "Hotel", "Capsule Hotel", "Hotel", "Hotel", "Serviced Apartment", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Resort", "Hotel", 
  "Hotel", "Serviced Apartment", "Resort", "Resort", "Hotel", "Hotel", 
  "Resort", "Hostel", "Hotel", "Resort Villa", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Resort", "Hotel", "Resort", 
  "Hotel", "Hotel", "Hotel", "Resort", "Hostel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Resort", 
  "Hotel", "Hotel", "Hotel", "Serviced Apartment", "Hotel", "Hotel", 
  "Hotel", "Guest House / Bed &amp; Breakfast", "Resort", "Hotel", 
  "Hotel", "Hostel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Capsule Hotel", "Hostel", "Hostel", "Hostel", 
  "Hotel", "Hostel", "Capsule Hotel", "Hotel", "Hotel", "Hotel", 
  "Guest House / Bed &amp; Breakfast", "Hotel", "Resort Villa", "Resort", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", "Serviced Apartment", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", "Guest House / Bed &amp; Breakfast", 
  "Hostel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Capsule Hotel", "Hostel", "Hotel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Serviced Apartment", "Hotel", "Serviced Apartment", 
  "Hotel", "Hotel", "Hotel", "Hostel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Resort Villa", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Resort", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Resort", "Hotel", 
  "Hotel", "Hostel", "Resort", "Hotel", "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Serviced Apartment", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", 
  "Hotel", "Hotel", "Serviced Apartment", "Hotel", "Hotel", "Hostel", 
  "Hotel", "Hotel", "Hostel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Serviced Apartment", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Serviced Apartment", "Hotel", "Hostel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Resort Villa", "Guest House / Bed &amp; Breakfast", 
  "Hostel", "Serviced Apartment", "Resort", "Hotel", "Serviced Apartment", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Resort", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Serviced Apartment", "Serviced Apartment", 
  "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Guest House / Bed &amp; Breakfast", "Resort Villa", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hostel", "Hotel", "Hotel", "Hostel", "Resort", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Serviced Apartment", 
  "Hotel", "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", 
  "Hotel", "Hotel", "Apartment", "Capsule Hotel", "Resort", "Guest House / Bed &amp; Breakfast", 
  "Hostel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Resort", "Hotel", "Hostel", "Hotel", "Hotel", "Serviced Apartment", 
  "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Resort", "Hotel", "Hostel", "Hotel", "Hotel", "Resort Villa", 
  "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", "Resort", 
  "Hotel", "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", "Motel", 
  "Hotel", "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Capsule Hotel", "Resort", "Capsule Hotel", 
  "Guest House / Bed &amp; Breakfast", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", 
  "Hotel", "Hotel", "Resort", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Serviced Apartment", 
  "Hotel", "Hostel", "Hotel", "Hotel", "Hotel", "Serviced Apartment", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", 
  "Hotel", "Hotel", "Resort", "Hotel", "Guest House / Bed &amp; Breakfast", 
  "Hotel", "Hotel", "Hotel", "Resort", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Apartment", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Resort", "Hotel", "Resort", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Guest House / Bed &amp; Breakfast", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hostel", "Hotel", "Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Capsule Hotel", 
  "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Serviced Apartment", "Hotel", "Hotel", "Hotel", "Hotel", "Hotel", 
  "Hotel", "Hotel")), .Names = c("booking_date", "ADR", "city", 
  "star_rating", "accommodation_type_name"), row.names = c(30428L, 
  46391L, 14940L, 27176L, 35090L, 20363L, 8489L, 46544L, 20879L, 
  36738L, 4763L, 28998L, 2814L, 2965L, 37433L, 47842L, 46085L, 
  11515L, 4569L, 22190L, 22550L, 26732L, 35247L, 32197L, 31976L, 
  35781L, 40899L, 42078L, 37772L, 46643L, 26214L, 20883L, 38343L, 
  13900L, 14354L, 19653L, 7448L, 12055L, 2409L, 2343L, 31700L, 
  33692L, 13814L, 29026L, 16647L, 43936L, 12570L, 29051L, 8225L, 
  14813L, 38120L, 13092L, 24242L, 45683L, 36081L, 8287L, 46554L, 
  43986L, 16184L, 10703L, 26798L, 27329L, 39699L, 23092L, 21269L, 
  46170L, 24413L, 43189L, 3357L, 2662L, 47878L, 14702L, 22409L, 
  28438L, 6278L, 33642L, 24513L, 34560L, 21474L, 8251L, 18874L, 
  34876L, 40554L, 36323L, 20219L, 43299L, 25602L, 42317L, 15474L, 
  17962L, 18584L, 33699L, 15555L, 1138L, 28850L, 45870L, 42049L, 
  35307L, 40346L, 33763L, 13913L, 38201L, 34050L, 34028L, 11372L, 
  12575L, 28658L, 5343L, 37714L, 20348L, 8058L, 37842L, 944L, 291L, 
  2312L, 16523L, 3461L, 16235L, 30034L, 29539L, 34401L, 30564L, 
  39318L, 18160L, 27490L, 34451L, 32200L, 21346L, 24325L, 10340L, 
  44151L, 43841L, 30906L, 14389L, 46315L, 3997L, 34862L, 20629L, 
  3100L, 35594L, 38679L, 21746L, 13315L, 36094L, 42683L, 22210L, 
  19682L, 9901L, 1402L, 9232L, 12181L, 5684L, 39926L, 16726L, 45895L, 
  46540L, 31497L, 40706L, 39412L, 45451L, 1890L, 19721L, 43612L, 
  10520L, 21555L, 29835L, 21016L, 20241L, 21100L, 2550L, 28328L, 
  47173L, 7346L, 29827L, 5911L, 40268L, 43402L, 5741L, 43061L, 
  6312L, 36996L, 17523L, 2966L, 448L, 27595L, 47858L, 42008L, 45272L, 
  44928L, 45065L, 7599L, 41705L, 3640L, 27425L, 40656L, 47049L, 
  37045L, 25315L, 41336L, 44777L, 40471L, 44341L, 17956L, 28690L, 
  14623L, 20267L, 28694L, 42978L, 26743L, 35927L, 16853L, 21809L, 
  43390L, 43304L, 9222L, 15577L, 35987L, 21304L, 41109L, 8633L, 
  40561L, 43678L, 36490L, 10889L, 2837L, 32320L, 29061L, 36635L, 
  46708L, 43405L, 8555L, 32823L, 16750L, 42246L, 17810L, 16356L, 
  4451L, 47510L, 25596L, 43774L, 38164L, 20897L, 1191L, 42760L, 
  36887L, 15470L, 17414L, 34485L, 11036L, 18581L, 13608L, 34993L, 
  40560L, 35413L, 15108L, 974L, 35818L, 198L, 22671L, 18958L, 42789L, 
  8504L, 46016L, 6993L, 1684L, 41736L, 7684L, 19648L, 26747L, 9903L, 
  45581L, 27712L, 40722L, 29548L, 9175L, 8742L, 21790L, 5653L, 
  5441L, 37121L, 37002L, 18505L, 17082L, 33695L, 8941L, 7869L, 
  5662L, 39495L, 46883L, 44094L, 372L, 35122L, 34992L, 1382L, 40261L, 
  38868L, 47150L, 41423L, 31799L, 11166L, 12021L, 27978L, 32494L, 
  34083L, 18754L, 19391L, 20077L, 39137L, 35635L, 24515L, 1154L, 
  9105L, 11374L, 39896L, 32785L, 11338L, 27229L, 16676L, 30725L, 
  8720L, 42573L, 11251L, 30973L, 46044L, 16044L, 1686L, 3065L, 
  31033L, 38225L, 3139L, 21579L, 24744L, 23497L, 32576L, 26035L, 
  25412L, 40726L, 1957L, 41552L, 18528L, 22032L, 27344L, 346L, 
  46490L, 9629L, 27280L, 25362L, 32958L, 30395L, 35276L, 3400L, 
  37575L, 4318L, 28860L, 30360L, 27678L, 40181L, 37228L, 1833L, 
  17582L, 4701L, 39173L, 318L, 46334L, 44586L, 43362L, 3564L, 23666L, 
  8111L, 35116L, 31660L, 36330L, 13225L, 42373L, 24185L, 45397L, 
  30342L, 6586L, 8515L, 44125L, 14293L, 27004L, 8854L, 26231L, 
  45006L, 34266L, 28417L, 15406L, 10936L, 9826L, 4367L, 31780L, 
  21310L, 41255L, 707L, 16678L, 39072L, 32983L, 41530L, 19236L, 
  24483L, 33184L, 19792L, 12394L, 27848L, 25400L, 29892L, 40158L, 
  23367L, 137L, 15225L, 14517L, 23880L, 35808L, 6421L, 28492L, 
  47648L, 16710L, 5777L, 40580L, 27859L, 41747L, 2279L, 32491L, 
  19191L, 32726L, 16827L, 22152L, 4881L, 26734L, 21031L, 44365L, 
  2767L, 21475L, 29521L, 3209L, 35353L, 42371L, 28759L, 128L, 39321L, 
  28804L, 30509L, 28264L, 8091L, 25627L, 34214L, 35237L, 15287L, 
  26635L, 37070L, 12921L, 20635L, 6326L, 5959L, 28592L, 23517L, 
  35875L, 10451L, 29496L, 13395L, 3516L, 47326L, 40260L, 46806L, 
  6891L, 36981L, 38166L, 12490L, 33101L, 44653L, 15442L, 24451L, 
  20618L, 29923L, 16435L, 35197L, 32533L, 33186L, 5689L, 18918L, 
  43311L, 35236L, 14149L, 31781L, 36271L, 8165L, 39543L, 23001L, 
  35102L, 5099L, 38423L, 8910L, 188L, 14658L, 4566L, 4246L, 29735L, 
  26949L, 13322L), class = "data.frame")
  </code></pre>