Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
A Good Day to Doc Hard
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Mar 9, 2017
1 parent 6090f47 commit 72361c2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ notifications:
email: false
after_success:
- julia -e 'cd(Pkg.dir("DataArrays")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# - julia -e 'cd(Pkg.dir("DataArrays")); Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ DataArrays.jl
[![Build Status](https://travis-ci.org/JuliaStats/DataArrays.jl.svg?branch=master)](https://travis-ci.org/JuliaStats/DataArrays.jl)
[![Coverage Status](https://coveralls.io/repos/JuliaStats/DataArrays.jl/badge.svg?branch=master)](https://coveralls.io/r/JuliaStats/DataArrays.jl?branch=master)

Latest release:
[![DataArrays](http://pkg.julialang.org/badges/DataArrays_0.4.svg)](http://pkg.julialang.org/?pkg=DataArrays)
[![DataArrays](http://pkg.julialang.org/badges/DataArrays_0.5.svg)](http://pkg.julialang.org/?pkg=DataArrays)
[![DataArrays](http://pkg.julialang.org/badges/DataArrays_0.6.svg)](http://pkg.julialang.org/?pkg=DataArrays)

Documentation:
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaStats.github.io/DataArrays.jl/stable)
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaStats.github.io/DataArrays.jl/latest)


The DataArrays package extends Julia by introducing data structures that can contain missing data. In particular, the package introduces three new data types to Julia:

* `NA`: A singleton type that represents a single missing value.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/da.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ isna
allna
anyna
dropna
padNA
levels
```

Expand All @@ -37,4 +38,5 @@ setlevels!
replace!
PooledDataVecs
getpoolidx
reorder
```
19 changes: 18 additions & 1 deletion src/datavector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,24 @@ Base.sizehint!(pda::PooledDataVector, newsz::Integer) =
sizehint!(pda.refs, newsz)

# Pad a vector with NA's

"""
padNA(dv::AbstractDataVector, front::Integer, back::Integer) -> DataVector
Pad `dv` with `NA` values, `front` at the beginning of the array and `back` at the end.
# Examples
```jldoctest
julia> padNA(@data([1, 2, 3]), 1, 2)
6-element DataArrays.DataArray{Int64,1}:
NA
1
2
3
NA
NA
```
"""
function padNA(dv::AbstractDataVector,
front::Integer,
back::Integer)
Expand Down
8 changes: 7 additions & 1 deletion src/pooleddataarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,15 @@ function setlevels!{T,R}(x::PooledDataArray{T,R}, d::Dict{T,Any}) # this version
setlevels!(x, newpool)
end

"""
reorder(x::PooledDataArray) -> PooledDataArray
Return a `PooledDataArray` containing the same data as `x` but with the value pool sorted.
"""
reorder(x::PooledDataArray) = PooledDataArray(x, sort(levels(x))) # just re-sort the pool

reorder(x::PooledDataArray, y::AbstractVector...) = reorder(mean, x, y...)
### FIXME: this calls a method that doesn't exist
# reorder(x::PooledDataArray, y::AbstractVector...) = reorder(mean, x, y...)

### FIXME: this can't work because we don't know about DataFrames
# reorder(fun::Function, x::PooledDataArray, y::AbstractVector...) =
Expand Down

0 comments on commit 72361c2

Please sign in to comment.