Sample() from a data vector with NA values

sample constructs an output Vector{T} using the eltype of the input. You can use the in-place mutating sample! instead, and provide your own DataArray:

julia> sample!(a, similar(a, 5)) # Note the argument order; output comes second here
5-element DataArrays.DataArray{Int64,1}:
…

Perhaps changing sample to use similar internally would be generally useful.

1 Like