Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>@Martin Morgan noted that this was termed tab completion. The package <code>rcompletion</code> and later <code>rcompgen</code> were tasked with achieving this. They have been now moved to <code>utils</code>.</p> <p><a href="http://r.789695.n4.nabble.com/R-R-pkgs-rcompletion-update-td815363.html" rel="nofollow">rcompletion update</a></p> <p>I looked thru the code for <code>completion.R</code> and from what I could determine <code>utils:::.DollarNames.environment</code> was handling tab completion for reference classes.</p> <p><a href="http://svn.r-project.org/R/trunk/src/library/utils/R/completion.R" rel="nofollow">completion.R</a></p> <p>Redefining the function seemed to achieve tab completion:</p> <pre><code>assignInNamespace( x = ".DollarNames.environment", function(x, pattern = "") { y &lt;- NULL if(isS4(x) &amp;&amp; !is.null(x[['.refClassDef']])){ if(.hasSlot(x$.refClassDef,'refMethods')){ y&lt;-x$.refClassDef@refMethods y&lt;-ls(y, all.names = TRUE, pattern = pattern) } } x&lt;-ls(x, all.names = TRUE, pattern = pattern) unique(c(x,y)) } ,ns = "utils") </code></pre> <p>Some things to note:</p> <ul> <li><p>I would only use this for my own use. Currently I am debugging and documenting a package. I had some longish method names and couldnt remember exactly what they were so tab completion will help greatly.</p></li> <li><p>Usage of <code>assignInNamespace</code> in a package is frowned upon (if not banned) see <code>?assignInNamespace</code>.</p></li> <li><p>Forced definition of methods is more advisable.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload