title: update function in R
body: <p>I am trying to use <code>update</code> function on <code>survey.design</code> object. For instance, I want to create a variable that is the mean of 4 other variables, as follows </p>
  
  <pre><code>x1&lt;-runif(3)
  x2&lt;-runif(3)
  x3&lt;-runif(3)
  population=10000
  testdf&lt;-data.frame(x1,x2,x3,population)
  testsvy&lt;-svydesign(id=~1,weights=c(30,30,30),data=testdf)
  testsvy&lt;-update(testsvy,avg=mean(c(x1,x2,x3)))
  </code></pre>
  
  <p>However this returns a vector of the same number for every person. There must be something wrong. Alternatively I can modify on <code>test$variables</code>, but I don't feel that this is the easiest way...</p>