<p dir="ltr">Let's follow an example. I'm developing my own package. I add data.table to imports in my description file. This means I have to use the :: operator each time I want to call a data.table function.  Can I use := in this setup?</p>
<br><div class="gmail_quote">On Tue, Jan 20, 2015, 10:01 Arunkumar Srinivasan <<a href="mailto:aragorn168b@gmail.com">aragorn168b@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Juan,<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr"><br>I already know that. </p></blockquote><div>Okay, great. </div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">I usually struggle when using data.table inside my own packages. I start by listing it in imports only (and not importing anything) </p></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>"imports only (and not importing anything)"?  - what do you mean?</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">but end up depending on it, as for the users to be able to manipulate the data.tables with [ and :=. </p></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>It depends on whether you want the data.table NAMESPACE to be attached or not. I think these posts may help:</div><div><a href="http://r.789695.n4.nabble.com/Re-R-CMD-check-checking-in-development-version-of-R-td4696125.html#none" target="_blank">http://r.789695.n4.nabble.com/Re-R-CMD-check-checking-in-development-version-of-R-td4696125.html#none</a></div><div><a href="http://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends" target="_blank">http://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends</a> </div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">I end up importing some or all of data.table also, because I don't know how to call := the :: notation. <br></p></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't really follow this. Why do you want to use `::` along with `:=`. The last post we just discussed that it can't be done, as it is not designed to be used outside of  `[...]` and in very specific ways. Check data.table:::`:=`. It is designed to error. This post might help: <a href="http://stackoverflow.com/q/7033106/559784" target="_blank">http://stackoverflow.com/q/7033106/559784</a></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">
My specific problem was on using := during on.Load. </p></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>It'd be useful to know what you are trying to do, along with your code. </div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">I already know how to use it, and know that it can only be used inside [.<br>
Maybe it is imperative to @import data.table to be able to use :=?</p></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't follow exactly how you are trying to use := to answer this. </div><div><br></div><div>Arun</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr"> </p><div><div>
<br><div class="gmail_quote">On Mon, Jan 19, 2015, 19:35 Arunkumar Srinivasan <<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Within the square brackets in "DT[ .... ]" and even there, only in `j` (as the error message points out).</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 19, 2015 at 11:31 PM, Juan Manuel Truppia <span dir="ltr"><<a href="mailto:jmtruppia@gmail.com" target="_blank">jmtruppia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">Arun, what does "within the frame of data.table" mean? </p><div><div>
<br><div class="gmail_quote">On Mon, Jan 19, 2015, 19:17 Arunkumar Srinivasan <<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Juan,<div><br></div><div>`:=` is designed to be used only within the frame of data.table. </div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 19, 2015 at 10:45 PM, Juan Manuel Truppia <span dir="ltr"><<a href="mailto:jmtruppia@gmail.com" target="_blank">jmtruppia@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi, I'm using data.table inside my own packages. I'm having some trouble using data.table functions on my .onLoad method.<div>I'm actually depending (not importing) data.table, but even then, I can't get := to work in .onLoad.</div><div>I'm using the `:=`(a = x, b = y) version, and getting</div><div><br></div><div>Error in `:=`(a = x) :</div><div>Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").</div><div><br></div><div>If I comment that, and then run it from the console after the package is loaded, it works.</div><div><br></div><div>Any ideas?</div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br></blockquote></div><br></div>
</blockquote></div>
</div></div></blockquote></div><br></div>
</blockquote></div>
</div></div></blockquote></div></div></div></blockquote></div>