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

.SDcols accepts a function to filter on values #3991

Merged
merged 3 commits into from
Dec 20, 2019
Merged

.SDcols accepts a function to filter on values #3991

merged 3 commits into from
Dec 20, 2019

Conversation

MichaelChirico
Copy link
Member

Closes #3950

@codecov
Copy link

codecov bot commented Oct 25, 2019

Codecov Report

Merging #3991 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3991      +/-   ##
==========================================
+ Coverage   99.41%   99.41%   +<.01%     
==========================================
  Files          72       72              
  Lines       13904    13909       +5     
==========================================
+ Hits        13823    13828       +5     
  Misses         81       81
Impacted Files Coverage Δ
R/data.table.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 751e851...4a724ca. Read the comment docs.

@mattdowle mattdowle added this to the 1.12.9 milestone Dec 20, 2019
@mattdowle mattdowle merged commit 39be78e into master Dec 20, 2019
@mattdowle mattdowle deleted the sdcols_fun branch December 20, 2019 07:34
@jangorecki jangorecki modified the milestones: 1.12.11, 1.12.9 May 26, 2020
@@ -65,6 +65,9 @@ unit = "s")
# data.table::fcase 1.49 1.55 1.67 1.71 1.73 1.86 5
```

7. `.SDcols=is.numeric` now works; i.e., `SDcols=` accepts a function which is used to select the columns of `.SD`, [#3950](https:/Rdatatable/data.table/issues/3950). Any function (even _ad hoc_) that returns scalar `TRUE`/`FALSE` for each column will do; e.g., `.SDcols=!is.character` will return _non_-character columns (_a la_ `Negate()`). Note that `patterns=` can still be used for filtering based on the column names.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patterns= looks a bit misleading to me, looks like an argument of [, e.g. dt[i, lapply(.SD, mean), patterns="^x"].

Copy link
Member

@mattdowle mattdowle Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot. I filed to #4642 to fix that.

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.

.SDcols=function shorthand
4 participants