<p dir="ltr">Caso ainda não tenha resolvido... Uma solução é o seu tryCatch retornar list(value=NA) em caso de erro. </p>
<div class="gmail_quote">On 16 Jul 2013 13:20, "Pedro Rafael" <<a href="mailto:pedro.rafael.marinho@gmail.com">pedro.rafael.marinho@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Valeu Benilton. Acho que o problema é esse mesmo. Abraços.</div><div class="gmail_extra"><br clear="all"><div>[ ],<br>Pedro Rafael Diniz Marinho.</div>
<br><br><div class="gmail_quote">Em 16 de julho de 2013 12:26, beniltoncarvalho [via R-br] <span dir="ltr"><<a href="mailto:ml-node+s2285057n4659994h91@n4.nabble.com" target="_blank">ml-node+s2285057n4659994h91@n4.nabble.com</a>></span> escreveu:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Quando myintegrate() retorna NA, você está tentando obter NA$value... </p>
<div class="gmail_quote"><div><div>On 16 Jul 2013 10:52, "Pedro Rafael" <<a href="http://user/SendEmail.jtp?type=node&node=4659994&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> wrote:<br type="attribution">
</div></div><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div><div>
<div dir="ltr">Pessoal estou criando uma função em R em que em determinada linha ocorre essa mensagem: <span style="color:rgb(197,6,11);background-color:rgb(225,226,229);font-family:'DejaVu Sans Mono';font-size:13px;line-height:16px;white-space:pre-wrap">$ operator is invalid for atomic vectors</span><div>
<font color="#c5060b" face="DejaVu Sans Mono"><span style="line-height:16px;white-space:pre-wrap"><br></span></font></div>O trecho do código é:<div><font color="#c5060b" face="DejaVu Sans Mono"><span style="line-height:16px;white-space:pre-wrap"><br>
</span></font></div><div>myintegrate = function(...) tryCatch(integrate(...), error=function(e) NA) <br>value_int = myintegrate(f=fdp,par=starts,lower=domain[1],upper=domain[2])$value<br>if(isTRUE(<a href="http://is.na" rel="nofollow" link="external" target="_blank">is.na</a>(value_int))==TRUE) warning("Make sure that fdp is a probability density function. The integral in the domain specified is not convergent.")</div>
<div><font color="#c5060b" face="DejaVu Sans Mono"><span style="line-height:16px;white-space:pre-wrap"><div> </div></span></font><div>[ ],<br>Pedro Rafael Diniz Marinho.</div>
</div></div>
<br></div></div>_______________________________________________<br>
R-br mailing list<br>
<a href="http://user/SendEmail.jtp?type=node&node=4659994&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" 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" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div>
<br>_______________________________________________
<br>R-br mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=4659994&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" 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" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.
<br>
<br>
<hr noshade size="1" color="#cccccc">
<div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://r-br.2285057.n4.nabble.com/R-br-Erro-operator-is-invalid-for-atomic-vectors-tp4659992p4659994.html" target="_blank">http://r-br.2285057.n4.nabble.com/R-br-Erro-operator-is-invalid-for-atomic-vectors-tp4659992p4659994.html</a>
</div>
<div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To unsubscribe from R-br, <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3357982&code=cGVkcm8ucmFmYWVsLm1hcmluaG9AZ21haWwuY29tfDMzNTc5ODJ8NTAyMjI0MDYw" target="_blank">click here</a>.<br>
<a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank">NAML</a>
</div></blockquote></div><br></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>