Utility functions

DataArrays.cutFunction.
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]"
source
DataArrays.glFunction.
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
source
DataArrays.xtabConstant.
xtab(x::AbstractArray) -> xtab

Construct a cross-tabulation table from the unique values in x. Currently only one-way tables are supported. Returns an xtab object.

source
DataArrays.xtabsFunction.
xtabs(x::AbstractArray) -> Dict

Construct a cross-tabulation table from the unique values in x, returning a Dict. Currently only one-way tables are supported.

source
DataArrays.reldiffFunction.
reldiff(v::Vector) -> Vector

For each element in v, compute the relative difference from the previous element.

Examples

julia> reldiff([1.0, 2.0, 3.0, 4.0])
3-element Array{Float64,1}:
 2.0
 1.5
 1.33333
source
percent_change(v::Vector) -> Vector

For each element in v, compute the percent change from the previous element.

Examples

julia> percent_change([1.0, 2.0, 3.0, 4.0])
3-element Array{Float64,1}:
 1.0
 0.5
 0.333333
source