title: Building a sum index in R
body: <p>I want to build a sumindex in R from several variables of my data set, e.g. <code>v110</code>, <code>v111</code> etc.  For this I have coded the variables as dummy variables, which are now called <code>_recode</code>, to form three categories with an average index.  These are the variables ending in <code>contacts</code>, <code>holiday</code> and <code>longystays</code>.  These must be weighted with <code>0.3</code> or <code>0.4</code>.  In the end I want to create the sum index called <code>transnat</code>, consisting of the 3 categories. I know that when I multiply by 10 I will expand the range at the end.  But my output shows a range from -17 to 10.</p>
  <p>This is my code:</p>
  <pre><code>data_issp$transnat_contacts &lt;- (data_issp$v110_recode - data_issp$v111_recode - data_issp$v112_recode - data_issp$v113_recode) * 0.3
  
  data_issp$transnat_holiday &lt;- (data_issp$v119_recode) * 0.3
  
  data_issp$transnat_longstays &lt;- (data_issp$v115_recode - data_issp$v116_recode - data_issp$v117_recode) * 0.4
  
  table(data_issp$transnat_contacts)
  table(data_issp$transnat_holiday)
  table(data_issp$transnat_longstays)
  </code></pre>
  <p>Output:
  <img src="https://i.stack.imgur.com/QN8Gf.png" alt="output" /></p>
  <pre><code>data_issp_transnat &lt;- (data_issp$transnat_contacts + data_issp$transnat_holiday + data_issp$transnat_longstays) * 10
  
  table(data_issp_transnat)
  </code></pre>
  <p>Final output:
  <img src="https://i.stack.imgur.com/teslb.png" alt="final output" /></p>