Categorize observation based on similarity to observed pattern in R
<p><strong>Edited for clarity:</strong>
I'm using R and I have a set of data that consists of order days:</p>

<pre><code>&gt; orders &lt;- data.frame(order.num=1:4,
+                      day = c("Mon", "Mon", "Mon", "Tue"))
&gt; orders
  order.num day
1         1 Mon
2         2 Mon
3         3 Mon
4         4 Tue
...
</code></pre>

<p>Orders typically come in on a consistent day (Monday in example above), but sometimes they come in on an alternate day (Tuesday in example above). </p>

<p>Here is actual data, spread into columns using dplyr::spread function </p>

<pre><code>  Outlet.number Sun Mon Tue Wed Thu Fri Sat
1             1   0 530 162   0 629  49   0
2             2   0 784 123   0 854  65   0
3             3  24  15 483   0 365   0   0
</code></pre>

<p>For Outlet 1, the "typical" order days are Monday and Thursday
For Outlet 2, the "typical" order days are Monday and Thursday
For Outlet 3, the "typical" order days are Tuesday and Thursday</p>

<p>I want to be able to predict if an order on an atypical day (e.g. Tue for Outlet 1) is more likely to be associated with the first typical day (Monday) or the second typical day (Thursday)</p>

<p>Neither of these examples have any orders on Wednesdays so I was able to hard code this small set, but for future outlets, Wednesday may either be a typical or atypical day. </p>

<p>Is there a way to ingest the data as shown above and then classify them? </p>