Skip to content

Commit e1dc967

Browse files
authored
Fix manual about propagation of missing values (#35264)
1 parent fa071ff commit e1dc967

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

doc/src/manual/missing.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ and behaves like them in most situations.
1111

1212
## Propagation of Missing Values
1313

14-
The behavior of `missing` values follows one basic rule: `missing`
15-
values *propagate* automatically when passed to standard operators and functions,
16-
in particular mathematical functions. Uncertainty about the value of one of the operands
17-
induces uncertainty about the result. In practice, this means an operation involving
18-
a `missing` value generally returns `missing`
14+
`missing` values *propagate* automatically when passed to standard mathematical
15+
operators and functions.
16+
For these functions, uncertainty about the value of one of the operands
17+
induces uncertainty about the result. In practice, this means a math operation
18+
involving a `missing` value generally returns `missing`
1919
```jldoctest
2020
julia> missing + 1
2121
missing
@@ -31,12 +31,17 @@ As `missing` is a normal Julia object, this propagation rule only works
3131
for functions which have opted in to implement this behavior. This can be
3232
achieved either via a specific method defined for arguments of type `Missing`,
3333
or simply by accepting arguments of this type, and passing them to functions
34-
which propagate them (like standard operators). Packages should consider
34+
which propagate them (like standard math operators). Packages should consider
3535
whether it makes sense to propagate missing values when defining new functions,
3636
and define methods appropriately if that is the case. Passing a `missing` value
3737
to a function for which no method accepting arguments of type `Missing` is defined
3838
throws a [`MethodError`](@ref), just like for any other type.
3939

40+
Functions that do not propagate `missing` values can be made to do so by wrapping
41+
them in the `passmissing` function provided by the
42+
[Missings.jl](https://github.com/JuliaData/Missings.jl) package.
43+
For example, `f(x)` becomes `passmissing(f)(x)`.
44+
4045
## Equality and Comparison Operators
4146

4247
Standard equality and comparison operators follow the propagation rule presented

0 commit comments

Comments
 (0)