<span class="Apple-style-span" style="border-collapse:separate;font-family:Arial;font-size:medium"><span class="Apple-style-span" style="font-family:'Lucida Console';font-size:13px;line-height:17px;text-align:-webkit-left;white-space:pre-wrap"><pre tabindex="0" class="GD40030CLR" style="font-family:'Lucida Console';font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-bottom:0px;line-height:1.3">
<span class="GD40030CCR ace_keyword" style="color:blue">subset(dados, y != 10 | <a href="http://is.na">is.na</a>(y))</span></pre></span></span><br><div class="gmail_quote">2011/12/26 Pedro Rafael <span dir="ltr"><<a href="mailto:pedro.rafael.marinho@gmail.com">pedro.rafael.marinho@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pessoal como fazer um comando subset contar os elementos NA? Considere o data.frame abaixo:<br><br><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Arial;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:Monospace;font-size:13px;line-height:17px;text-align:-webkit-left;white-space:pre-wrap"><pre style="font-family:Monospace;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:1.3">
dados = data.frame(x = c(1,2,3,7,12), y = c(0,10,2,3,NA))<br><br>Com este data.frame chamado dados gostaria de filtrar com o subset os elementos de y que são diferente de 10. Para o meu exemplo NA também é diferente de 10 e gostaria de fosse contabilizado. Com o mando abaixo o resultado segue logo após.<br>
<br>> subset(dados, y != 10)<span style="color:blue">
</span> x y
1 1 0
3 3 2
4 7 3<br><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Arial;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:Monospace;font-size:13px;line-height:17px;text-align:-webkit-left;white-space:pre-wrap"><pre style="font-family:Monospace;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:1.3">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Arial;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:Monospace;font-size:13px;line-height:17px;text-align:-webkit-left;white-space:pre-wrap"><pre style="font-family:Monospace;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:1.3">
<br>Veja que o NA não foi contabilizado. <span class="HOEnZb"><font color="#888888"><br></font></span></pre></span></span><span class="HOEnZb"><font color="#888888"><span style="color:blue"></span></font></span></pre></span></span><span class="HOEnZb"><font color="#888888"><br>
</font></span></pre></span></span><span class="HOEnZb"><font color="#888888"><br>-- <br><font color="#000099">Saudações,</font><div>
<font color="#000099">Pedro Rafael Diniz Marinho.</font></div><div><font color="#000099">Estatístico - Secretaria de Estado da Saúde - PB.</font></div><div><font color="#000099"><br></font></div><br>
</font></span><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>