-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to avoid check NOTE for ..variables in j? #4741
Comments
My 2c: seems that warning is useful in some cases, so removing it is undesirable. Instead, can we just NOT deprecate with=FALSE? |
Also note there is pending PR #4304 which will give another interface for such queries. |
I have silenced the Notes on R CMD check regarding "no visible binding for global variable ..a, ..b etc." ..a = "..a"; ..b = "..b" inside my function. I have had to do the same with the special J. The program runs fine but with the warning "both ..a and "..a" etc. are in the calling scope ....". So I have had to set
at the top of my function. One other variable was an index set inside a DT defined as Thank you! |
@drag05 please post complete minimal example |
@jangorecki : I will start with the fix on then, off. The variables are uv, ..uv and id
|
Naming your variable with double dot prefix is quite likely confuse reader or even interface. Double dot is used for looking up a variable in different scope. You can use new interface added in PR you mentioned to explicitly refer to variables and not rely on parent environment scope. |
I used double dot per description of "with" in Returning to the issue, please help me understand correctly: The correct code is, for example:
instead of
or, instead of:
UPDATE: After few trials, I got Error: "unused argument "env"..." Thank you! |
You can use verbose=TRUE to see how your query looks like after substitution from env argument. Use of double dot prefix is designed to find variables named like double dot prefixed string, so defining a variable which has double dot in its name is not the correct use of it. |
Hello!
in my Thus, the NOTE is eliminated, while |
@iofeidis also please read our importing data.table vignette, using onLoad function should not be needed to register global variables. |
@tdhock could you please check if using new nev argument instead will resolve your problem reported here? |
I have decided to go with
for now. Everything seems to be working, including the tests. No Notes or anything else. |
the |
hi @jangorecki thanks for the suggestion to use env argument, but I do not think that is the best solution here. (correct me if I am mis-understanding something or using env sub-optimally though) other.values = lapply(group.dt[, is.other, with=FALSE], unique) I changed that line of code to the following, other.values = lapply(group.dt[, is.other, env=list(is.other=is.other)], unique) both are OK in terms of CRAN checks (no NOTE). So technically env argument works to avoid the NOTE. But using it in this way results in repeating the name |
Yes, agree in this case |
Have any updates or official recommendations been made for this check NOTE due to |
Afaict no, probably because metaprogramming interface via .. is rather limited as of now. Extending it went into low priority area because env arg already covers all metaprogramming cases. |
this is related to #2988
I put a line of code in R/fmelt.R
and when I checked data.table I got
so I tried the usual trick,
But that gave me this warning from R/data.table.R,
Eventually I removed the two dots altogether and instead used,
which works fine (no NOTE nor warning), but from the docs and #2826 it seems that with=FALSE will be deprecated in the future. If that is the case then how should R package developers who use ..something avoid that NOTE?
The text was updated successfully, but these errors were encountered: