Skip to content
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

avoid with=FALSE in doc example #5594

Merged
merged 3 commits into from
Dec 14, 2023
Merged

Conversation

MichaelChirico
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cb8aeff) 97.49% compared to head (1813f67) 97.46%.
Report is 82 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5594      +/-   ##
==========================================
- Coverage   97.49%   97.46%   -0.03%     
==========================================
  Files          80       80              
  Lines       14810    14822      +12     
==========================================
+ Hits        14439    14447       +8     
- Misses        371      375       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TysonStanley TysonStanley added this to the 1.15.0 milestone Dec 10, 2023
@jangorecki
Copy link
Member

I am not sure about this change.
For package developers who imports data.table the with=FALSE interface is generally preferred as they don't have to deal with extra NOTEs during package check about global variables. For the same reason, in my packages, I use DT[..., by=c("a","b")], rather than DT[..., by=.(a, b)].

@TysonStanley
Copy link
Member

Since it is just an example, can we include both then? I think it makes sense to show both with something like:

To reorder \code{data.table} columns, the idiomatic way is to use \code{setcolorder(x, neworder)}, instead of doing \code{x <- x[, ..neworder]} (or \code{x <- x[, neworder, with=FALSE]}). This is because the latter makes an entire copy of the \code{data.table}, which maybe unnecessary in most situations. \code{setcolorder} also allows column numbers instead of names for \code{neworder} argument, although we recommend using names as a good programming practice.

man/setcolorder.Rd Outdated Show resolved Hide resolved
@MichaelChirico MichaelChirico merged commit 7f5498a into master Dec 14, 2023
2 of 3 checks passed
@jangorecki jangorecki deleted the MichaelChirico-patch-10 branch December 14, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants