Skip to content

Commit ae4831d

Browse files
authored
Merge pull request #141 from piever/specialdocs
add docs for special selectors (and export them)
2 parents ce78c9a + e5d83fc commit ae4831d

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

docs/src/api/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ Derivatives of [`select`](@ref) that are convenient for modifying a table's colu
3838
- [`insertcolbefore`](@ref) - insert a column before another
3939
- [`renamecol`](@ref) - rename a column
4040

41+
Special selectors to select a subset of columns.
42+
43+
- [`All`](@ref) - select all columns
44+
- [`Not`](@ref) - select complementary
45+
- [`Keys`](@ref) - select primary columns
46+
- [`Between`](@ref) - select columns between two extremes
47+
4148
## [Aggregation](@ref)
4249

4350
Grouping and reduction with functions or Online statistics.

docs/src/api/selection.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,41 @@ insertcolbefore
8585
```@docs
8686
renamecol
8787
```
88+
89+
## Column special selection
90+
91+
This section describes some special types that can be used to simplify column selection. These types can be used in combination with `select`, `rows` or `columns`, as well as any other function that requires a `by` or `select` argument.
92+
93+
```@docs
94+
All
95+
```
96+
97+
```@docs
98+
Not
99+
```
100+
101+
```@docs
102+
Keys
103+
```
104+
105+
```@docs
106+
Between
107+
```
108+
109+
Finally, to select columns whose name respects a given predicate, pass a function to `select` (or `rows`, or `columns`):
110+
111+
```jldoctest specialselector
112+
julia> t = table([0.01, 0.05], [2,1], [2, 3], names=[:t, :x, :z])
113+
Table with 2 rows, 3 columns:
114+
t x z
115+
──────────
116+
0.01 2 2
117+
0.05 1 3
118+
119+
julia> select(t, i -> i != :z)
120+
Table with 2 rows, 2 columns:
121+
t x
122+
───────
123+
0.01 2
124+
0.05 1
125+
```

src/JuliaDB.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export IndexedTable, NDSparse, NextTable, Columns, colnames,
1515
table, ndsparse, compute, groupby, summarize, groupreduce, groupjoin,
1616
ColDict, insertafter!, insertbefore!, @cols, setcol, pushcol,
1717
popcol, insertcol, insertcolafter, insertcolbefore, permutecols,
18-
renamecol, NA, dropna, flatten, ML
18+
renamecol, NA, dropna, flatten, ML, All, Not, Between, Keys
1919

2020
include("util.jl")
2121
include("serialize.jl")

0 commit comments

Comments
 (0)