Skip to content

Instantly share code, notes, and snippets.

@StefanKarpinski
Created December 7, 2012 20:27
Show Gist options
  • Select an option

  • Save StefanKarpinski/4236254 to your computer and use it in GitHub Desktop.

Select an option

Save StefanKarpinski/4236254 to your computer and use it in GitHub Desktop.
type DataVec{T} <: AbstractDataVec{T}
data::Vector{T}
na::BitVector
# Sanity check that new data values and missingness metadata match
function DataVec(data::Vector{T}, na::BitVector)
if length(data) != length(na)
error("data and NA vectors not the same length!")
end
new(data,na)
end
end
DataVec{T}(data::Vector{T}, na::BitVector) = DataVec{T}(data,na)
@StefanKarpinski

Copy link
Copy Markdown
Author
forall T
    type DataVec{T} <: AbstractDataVec{T}
        data::Vector{T}
        na::BitVector

        # Sanity check that new data values and missingness metadata match
        function DataVec(data::Vector{T}, na::BitVector)
            if length(data) != length(na)
                error("data and NA vectors not the same length!")
            end
            new(data,na)
        end
    end

    DataVec(data::Vector{T}, na::BitVector) = DataVec{T}(data,na)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment