 <p>We can use <code>cut</code> to produce bins and <code>sub</code> to rename them</p> <pre><code>mtcars$dispR &lt;- as.character(cut(mtcars$disp,breaks = seq(0,500,100),right=FALSE)) mtcars$dispR &lt;- sub("\\[(\\d{1,3}).*","\\1+",mtcars$dispR) </code></pre> <p>Then, to add the proportion, we can use <code>questionr::rprop</code></p> <pre><code>library(questionr) rprop(table(mtcars$gear,mtcars$dispR)) 0+ 100+ 200+ 300+ 400+ Total 3 0.0 6.7 33.3 33.3 26.7 100.0 4 33.3 66.7 0.0 0.0 0.0 100.0 5 20.0 40.0 0.0 40.0 0.0 100.0 Ensemble 15.6 34.4 15.6 21.9 12.5 100.0 </code></pre> <p>This second step may be done in base R with <code>addmargins</code></p> <pre><code>t &lt;- addmargins(table(mtcars$gear,mtcars$dispR)) round(t/t[,"Sum"] * 100,1) 0+ 100+ 200+ 300+ 400+ Sum 3 0.0 6.7 33.3 33.3 26.7 100.0 4 33.3 66.7 0.0 0.0 0.0 100.0 5 20.0 40.0 0.0 40.0 0.0 100.0 Sum 15.6 34.4 15.6 21.9 12.5 100.0 </code></pre>