Prezados amigos da lista<div><br></div><div>Que 2012 seja repleto de sucesso.</div><div><br></div><div>Minha dúvida.</div><div>Elaborei um questionário e atribuí pontos para as diferentes respostas. Como codifico uma função para gerar uma variável que será o resultado da computação da soma dos pontos de cada indivíduo de acordo com suas respostas?</div>
<div>Abaixo segue o esquema de pontuação das questões que entram no cálculo.</div><div><br></div><div><div>Pergunta Resposta Pontuação</div><div>p1<span class="Apple-tab-span" style="white-space:pre">        </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>p2<span class="Apple-tab-span" style="white-space:pre">    </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>4<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>5<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>6<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>p3.1<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.2<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.3<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.4<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.5<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.6<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P3.7<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>p4<span class="Apple-tab-span" style="white-space:pre">    </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>4<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>5<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>6<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.1<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.2<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.3<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.4<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.5<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.6<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.7<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.8<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.9<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P5.10<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>p6<span class="Apple-tab-span" style="white-space:pre">    </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>4<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>5<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>6<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.1<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.2<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.3<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.4<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.5<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.6<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P7.7<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P8.1<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P8.2<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P8.3<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P8.4<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P8.5<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.1<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.2<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.3<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.4<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.5<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.6<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P9.7<span class="Apple-tab-span" style="white-space:pre">  </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.1<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.2<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.3<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.4<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.5<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.6<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>P10.7<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div>p11<span class="Apple-tab-span" style="white-space:pre">   </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>4<span class="Apple-tab-span" style="white-space:pre">   </span>0</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>5<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div>p15<span class="Apple-tab-span" style="white-space:pre"> </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>5</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>3</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>3<span class="Apple-tab-span" style="white-space:pre">   </span>3</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>4<span class="Apple-tab-span" style="white-space:pre">   </span>1</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>5<span class="Apple-tab-span" style="white-space:pre">   </span>1</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>6<span class="Apple-tab-span" style="white-space:pre">   </span>0</div><div><br></div><div><br></div><div>Também: como substituir os NAs por zeros de uma vez só?</div>
<div><br></div><div>Agradeço antecipadamente qualquer ajuda.</div><div><br></div>-- <br>Atenciosamente,<br><br>Prof. Carlos A. S. de Andrade<br>LAPEA - Laboratório de Pesquisa em Economia Aplicada e Engenharia de Produção<br>
<div>Universidade Federal de Campina Grande.<br></div><div> Centro de Humanidades 
 </div><div>Unidade Acadêmica de Economia</div><br>
</div>