Skip to content

Commit f45ed1f

Browse files
authored
Merge pull request #9 from matthieugomez/patch-7
Update README.md
2 parents c4eaa56 + a6b13f7 commit f45ed1f

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ The package is registered in the [`General`](https://github.com/JuliaRegistries/
77

88
## Introduction
99
GroupedArray is an AbstractArray that contains positive integers or missing values.
10+
- `GroupedArray(x::AbstractArray)` returns a `GroupedArray` of the same length as the original array, where each distinct value is encoded as a distinct integer.
11+
- `GroupedArray(xs...::AbstractArray)` returns a `GroupedArray` where each distinct combination of values is encoded as a distinct integer
12+
- By default (with `coalesce = false`), `GroupedArray` encodes `missing` values as a distinct `missing` category. With `coalesce = true`, missing values are treated similarly to other values.
1013

11-
- `GroupedArray(x::AbstractArray)` returns a `GroupedArray` of the same length as the original array, where each distinct value is encoded by a distinct integer.
12-
- `GroupedArray(xs...::AbstractArray)` returns a `GroupedArray` where each distinct combination of values is encoded by a distinct integer
13-
- By default, `GroupedArray` groups all `missing` values into a distinct `missing` category. With `coalesce = true`, missing values are not treated differently.
14+
## Examples
1415

1516
```julia
1617
using GroupedArrays
1718
p = repeat(["a", "b", missing], outer = 2)
18-
g = GroupedArray(p)
19+
GroupedArray(p)
1920
# 6-element GroupedArray{Int64, 1}:
2021
# 1
2122
# 2
@@ -24,21 +25,17 @@ GroupedArray is an AbstractArray that contains positive integers or missing valu
2425
# 2
2526
# missing
2627
p = repeat(["a", "b", missing], outer = 2)
27-
g = GroupedArray(p; coalesce = true)
28+
GroupedArray(p; coalesce = true)
2829
# 6-element GroupedArray{Int64, 1}:
2930
# 1
3031
# 2
3132
# 3
3233
# 1
3334
# 2
3435
# 3
35-
```
36-
37-
- `GroupedArray(xs::AbstractArray...)` combine groups defined by multiple vectors:
38-
```julia
3936
p1 = repeat(["a", "b"], outer = 3)
4037
p2 = repeat(["d", "e"], inner = 3)
41-
g = GroupedArray(p1, p2)
38+
GroupedArray(p1, p2)
4239
# 6-element GroupedArray{Int64, 1}:
4340
# 1
4441
# 2

0 commit comments

Comments
 (0)