diff --git a/docs/source/misc.rst b/docs/source/misc.rst index 54569dd95..34878936b 100644 --- a/docs/source/misc.rst +++ b/docs/source/misc.rst @@ -25,24 +25,6 @@ Miscellaneous Functions Construct a dictionary that maps each distinct value in ``x`` to its first index. -.. function:: findat(a, x) - - For each element in ``x``, find its first index in ``a``. If the value does not appear in ``a``, the corresponding index is ``0``. - - **Examples:** - - .. code-block:: julia - - julia> findat([2,4,6], [2,3,4]) - 3-element Array{Int64,1}: - 1 - 0 - 2 - -.. function:: findat!(r, a, x) - - Write the results of ``findat(a, x)`` to a pre-allocated array ``r``. - .. function:: indicatormat(x, k[; sparse=false]) Construct a boolean matrix ``r`` of size ``(k, length(x))`` such that ``r[x[i], i] = true`` and all other elements are set to ``false``. diff --git a/src/deprecates.jl b/src/deprecates.jl index 28db02afe..ae56cf7b1 100644 --- a/src/deprecates.jl +++ b/src/deprecates.jl @@ -22,3 +22,5 @@ import Base.varm, Base.stdm @deprecate adjR2(obj::StatisticalModel, variant::Symbol) adjr2(obj, variant) @deprecate adjR²(obj::StatisticalModel, variant::Symbol) adjr²(obj, variant) +@deprecate findat(a, x) indexin(x, a) +@deprecate findat!(r, a, x) (y = indexin(x, a); copy!(r, y)) diff --git a/src/misc.jl b/src/misc.jl index a35b84037..71d816c24 100644 --- a/src/misc.jl +++ b/src/misc.jl @@ -77,7 +77,6 @@ function inverse_rle{T}(vals::AbstractVector{T}, lens::IntegerVector) end -# findat (get positions (within a) for elements in b) """ indexmap(a) @@ -115,25 +114,6 @@ function levelsmap{T}(a::AbstractArray{T}) return d end -function findat!{T}(r::IntegerArray, a::AbstractArray{T}, b::AbstractArray{T}) - length(r) == length(b) || raise_dimerror() - d = indexmap(a) - @inbounds for i = 1 : length(b) - r[i] = get(d, b[i], 0) - end - return r -end - - -""" - findat(a, b) - -For each element in `b`, find its first index in `a`. If the value does -not occur in `a`, the corresponding index is 0. -""" -findat(a::AbstractArray, b::AbstractArray) = findat!(Array(Int, size(b)), a, b) - - # indicatormat # x: input elements,