title: frequency table and group by multiple variables in r
body: <p>Folks, I need an elegant way of creating frequency count and group by multiple variables. Output should be a dataframe. I know the answer lies somewhere in using dplyr and data.table which I am still learning.
  I tried this <a href="https://i.stack.imgur.com/uWvk9.png" rel="nofollow noreferrer">link</a> but I want to do this using dplyr and data.table.</p>
  
  <p>Here is the sample data from the same link -</p>
  
  <pre><code>ID &lt;- seq(1:177)
  Age &lt;- sample(c("0-15", "16-29", "30-44", "45-64", "65+"), 177, replace = TRUE)
  Sex &lt;- sample(c("Male", "Female"), 177, replace = TRUE)
  Country &lt;- sample(c("England", "Wales", "Scotland", "N. Ireland"), 177, replace = TRUE)
  Health &lt;- sample(c("Poor", "Average", "Good"), 177, replace = TRUE)
  Survey &lt;- data.frame(Age, Sex, Country, Health)
  </code></pre>
  
  <p>Here is the output I am looking for. Thanks and appreciate your help!</p>
  
  <p><a href="https://i.stack.imgur.com/uWvk9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uWvk9.png" alt="enter image description here"></a></p>