Use o argumento "na.rm = TRUE"!<br><br><div class="gmail_quote">2012/1/5 Luiz André Zardo <span dir="ltr"><<a href="mailto:luiz.zardo@gmail.com">luiz.zardo@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>PREZADOS</div>
<div> </div>
<div>Preciso criar uma variavel Y que é a soma de outras 3 variaveis (X1+X2+X3), porém quando uma delas é algum NA não consigo fazer a soma das outras duas.</div>
<div>como resolvo isso, como nos casos 2 e 3 abaixo.</div>
<div> </div>
<div>
<table style="WIDTH:196pt;BORDER-COLLAPSE:collapse" border="0" cellspacing="0" cellpadding="0" width="263">
<colgroup>
<col style="WIDTH:44pt" width="59">
<col style="WIDTH:38pt" span="4" width="51">
</colgroup><tbody>
<tr style="min-height:12.75pt" height="17">
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;WIDTH:44pt;min-height:12.75pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" height="17" width="59">caso</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;WIDTH:38pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" width="51"><strong>X1</strong></td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;WIDTH:38pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" width="51"><strong>X2</strong></td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;WIDTH:38pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" width="51"><strong>X3</strong></td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;WIDTH:38pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" width="51"><strong>Y</strong></td></tr>
<tr style="min-height:12.75pt" height="17">
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;min-height:12.75pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" height="17">1</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">1</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">2</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">1</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">4</td></tr>
<tr style="min-height:12.75pt" height="17">
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;min-height:12.75pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" height="17">2</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">4</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">2</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">NA</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">NA</td></tr>
<tr style="min-height:12.75pt" height="17">
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;min-height:12.75pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" height="17">3</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">NA</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">2</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">1</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">NA</td></tr>
<tr style="min-height:12.75pt" height="17">
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;min-height:12.75pt;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8" height="17">4</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">2</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">0</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">3</td>
<td style="BORDER-BOTTOM:#ece9d8;BORDER-LEFT:#ece9d8;BACKGROUND-COLOR:transparent;BORDER-TOP:#ece9d8;BORDER-RIGHT:#ece9d8">5</td></tr></tbody></table></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br>