title: calculate mean for cases that responded to a minimum number of items in R
body: <p>In SPSS you can calculate means for cases that responded to a minimum number of questions. In SPSS I would type </p>
  
  <p>COMPUTE compvar = MEAN.4(var1, var2, var3, var4, var5, var6, var7).</p>
  
  <p>And this would generate a new variable (i.e., compvar) only for cases that had a value present for 4 or more of the array var1 - var7. That's what the .4 is doing in the command, setting a minimum number of responses before the command will run for a case. </p>
  
  <p>Any tips on doing this in R so I can stop jumping to SPSS? </p>