Utility functions
DataArrays.cut
โ Function.cut(x::AbstractVector, breaks::Vector) -> PooledDataArray
cut(x::AbstractVector, ngroups::Integer) -> PooledDataArray
Divide the range of x
into intervals based on the cut points specified in breaks
, or into ngroups
intervals of approximately equal length.
Examples
julia> cut([1, 2, 3, 4], [1, 3])
4-element DataArrays.PooledDataArray{String,UInt32,1}:
"[1,3]"
"[1,3]"
"[1,3]"
"(3,4]"
DataArrays.gl
โ Function.gl(n::Integer, k::Integer, l::Integer = n*k) -> PooledDataArray
Generate a PooledDataArray
with n
levels and k
replications, optionally specifying an output length l
. If specified, l
must be a multiple of n*k
.
Examples
julia> gl(2, 1)
2-element DataArrays.PooledDataArray{Int64,UInt8,1}:
1
2
julia> gl(2, 1, 4)
4-element DataArrays.PooledDataArray{Int64,UInt8,1}:
1
2
1
2