@Matt,
Actually, there currently do exist such constructors. One supplies the
desired eltype of the resultant NullableArray, as well as the specific
value that designates missingness in the argument array:
*julia> **A = rand(Bool, 10)*
*10-element Array{Bool,1}:*
* false*
* false*
* true*
* true*
* true*
* true*
* false*
* false*
* false*
* false*
*julia> **NullableArray(A, Bool, true)*
*10-element NullableArray{Bool,1}:*
* false*
* false*
* #NULL*
* #NULL*
* #NULL*
* #NULL*
* false*
* false*
* false*
* false*
It is currently "undocumented" because there are tentative plans to replace
it with different semantics (see
https://github.com/JuliaStats/NullableArrays.jl/pull/56#issuecomment-133995334).
On Sunday, October 18, 2015 at 1:11:16 PM UTC-7, Matt Bauman wrote:
>
> On Sunday, October 18, 2015 at 3:54:13 PM UTC-4, David Gold wrote:
>>
>> @Sebastian: If I understand you correctly, then it should at least be
>> possible. If T is your datatype that behaves as such and x is the value of
>> type T that designates missingness, then it seems you could
>> straightforwardly write your own method to convert an Array{T} to a
>> NullableArray{T} that sets a given entry in the target isnull field to true
>> iff the corresponding entry in the argument array is x. I don't know how
>> the pros and cons will play out for your specific use case.
>>
>
> It might be nice to add a constructor that supports arbitrary arrays,
> e.g., `NullableArray(data, data .== 9999)`, and does the conversions for
> you. In this case, you will at least need to convert the BitArray to an
> Array{Bool}.
>