title: Proportions by group with survey weights
body: <pre><code>data = data.frame(ID = 1:1000,
                    GROUP = factor(sample(1:5, rep = T)),
                    CAT = factor(sample(1:5, rep = T)),
                    DOG = factor(sample(1:5, rep = T)),
                    FOX = factor(sample(1:5, rep = T)),
                    MOUSE = factor(sample(1:5, rep = T)),
                    WEIGHT = round(runif(1000)*100,0)
                    )
  
  data_WANT = data.frame(VARS = c(&quot;CAT&quot;, &quot;DOG&quot;, &quot;FOX&quot;, &quot;MOUSE&quot;, &quot;WEIGHT&quot;),
                         GROUP1_N = NA,
                         GROUP1_PROP = NA,
                         GROUP2_N = NA,
                         GROUP2_PROP = NA,
                        GROUP3_N = NA,
                         GROUP3_PROP = NA,
                         GROUP4_N = NA,
                         GROUP4_PROP = NA,
                         GROUP5_N = NA,
                         GROUP5_PROP = NA)
  </code></pre>
  <p>I have a dataframe called 'data' and I wish to create a dataframe or datatable that presents the COUNT(_N) of each variable by GROUP and also the weighted proportion (_PROP) for each variable for each group using the variable WEIGHT in the dataframe called 'data'. This is a probability weight that is given to me to get representative estimates.</p>