title: Test if externalptr object is null
body: <p>How can I test from within R, without compiling custom C code, if an <code>externalptr</code> object is a null pointer? The best I can come up with is:</p>
  
  <pre><code>identical(capture.output(print(myptr)), "&lt;pointer: 0x0&gt;")
  </code></pre>
  
  <p>But that is kind of lame. I can do it in C, but I want to do it in R so that the user doesn't need a compiler.</p>