Skip to content

Commit 32a506a

Browse files
committed
add byrow(allequal) as a special case of byrow(isequal)
1 parent e3cc72c commit 32a506a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/byrow/byrow.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ byrow(ds::AbstractDataset, ::typeof(all), col::ColumnIndex; missings = missing,
111111
byrow(ds::AbstractDataset, ::typeof(isequal), cols::MultiColumnIndex; with = nothing, threads = nrow(ds) > Threads.nthreads()*10) = row_isequal(ds, cols, by = with, threads = threads)
112112
byrow(ds::AbstractDataset, ::typeof(isequal), cols::ColumnIndex; with = nothing, threads = nrow(ds) > Threads.nthreads()*10) = row_isequal(ds, cols, by = with, threads = threads)
113113

114+
if VERSION >= v"1.8"
115+
byrow(ds::AbstractDataset, ::typeof(allequal), cols::MultiColumnIndex; threads = nrow(ds) > Threads.nthreads()*10) = row_isequal(ds, cols, by = nothing, threads = threads)
116+
byrow(ds::AbstractDataset, ::typeof(allequal), cols::ColumnIndex; threads = nrow(ds) > Threads.nthreads()*10) = row_isequal(ds, cols, by = nothing, threads = threads)
117+
end
118+
119+
114120
byrow(ds::AbstractDataset, ::typeof(isless), cols::MultiColumnIndex; with, threads = nrow(ds) > Threads.nthreads()*10, rev::Bool = false, lt = isless) = row_isless(ds, cols, with, threads = threads, rev = rev, lt = lt)
115121
byrow(ds::AbstractDataset, ::typeof(isless), col::ColumnIndex; with, threads = nrow(ds) > Threads.nthreads()*10, rev::Bool = false, lt = isless) = row_isless(ds, [col], with, threads = threads, rev = rev, lt = lt)
116122

src/byrow/doc.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function Docs.getdoc(x::typeof(byrow), y)
1616
return _get_doc_byrow("prod")
1717
elseif y == Tuple{typeof(isequal)}
1818
return _get_doc_byrow("isequal")
19+
elseif VERSION >= v"1.8" && y == Tuple{typeof(allequal)}
20+
return _get_doc_byrow("allequal")
1921
elseif y == Tuple{typeof(isless)}
2022
return _get_doc_byrow("isless")
2123
elseif y == Tuple{typeof(in)}
@@ -105,6 +107,7 @@ Perform a row-wise operation specified by `fun` on selected columns `cols`. Gene
105107
# Reduction operations
106108
107109
- `all`
110+
- `allequal` (this needs Julia 1.8 or later)
108111
- `any`
109112
- `argmax`
110113
- `argmin`
@@ -369,6 +372,14 @@ julia> byrow(ds, isequal, [1,2], with = [2,2,2,3,3,3])
369372
0
370373
0
371374
```
375+
@@@@allequal@@@@
376+
byrow(ds::AbstractDataset, allequal, cols; [threads])
377+
378+
Returns a boolean vector which is `true` if all values in the corresponding row are equal (using `isequal`).
379+
380+
Passing `threads = false` disables multithreaded computations.
381+
382+
See [`byrow(isequal)`](@ref), [`byrow(isless)`](@ref), [`byrow(in)`](@ref), [`byrow(issorted)`](@ref)
372383
@@@@isless@@@@
373384
byrow(ds::AbstractDataset, isless, cols, [with, threads, rev = false, lt = isless])
374385

0 commit comments

Comments
 (0)