Skip to content

Commit 19fc0d0

Browse files
committed
add removing columns to doc
1 parent f41f1bc commit 19fc0d0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/src/man/basics.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ Columns information
333333

334334
The `content` function shows that the data set has been created on `2021-08-04T13:18:51.185`, and the last time that it has been modified is on `2021-08-04T13:24:33.086`.
335335

336-
### Adding a new column
336+
### Adding and removing columns
337337

338-
To add a new column (variable) to a data set use the `insertcols!` function,
338+
To add a new column (variable) to a data set use the `insertcols!` function. The `select` function and its in-place counterpart `select!` can be used to drop columns from a data set. The `select`(`select!`) function is used to rearange columns, however, using `Not(cols)` can be used to select all columns except those which are wrapped in `Not`.
339339

340340
```jldoctest
341341
julia> ds = Dataset(var1 = [1, 2, 3])
@@ -367,6 +367,16 @@ julia> insertcols!(ds, :var3 => [3.5, 4.6, 32.0])
367367
1 │ 1 val1 3.5
368368
2 │ 2 val2 4.6
369369
3 │ 3 val3 32.0
370+
371+
julia> select!(ds, Not(:var2))
372+
3×2 Dataset
373+
Row │ var1 var3
374+
│ identity identity
375+
│ Int64? Float64?
376+
─────┼────────────────────
377+
1 │ 1 3.5
378+
2 │ 2 4.6
379+
3 │ 3 32.0
370380
```
371381

372382
### Converting the columns' type

0 commit comments

Comments
 (0)