Skip to content

Commit aa022e5

Browse files
committed
Merge pull request #35 from JuliaStats/ts/passthrough
Add PassThrough type to make it easier to use Arrays and NullableArrays
2 parents e06dce4 + e19d464 commit aa022e5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/DataFramesMeta.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,23 @@ Base.getindex(gd::GroupedDataFrame, I::AbstractArray{Int}) = GroupedDataFrame(gd
515515
gd.starts[I],
516516
gd.ends[I])
517517

518+
519+
##############################################################################
520+
##
521+
## Extras for easier handling of Arrays
522+
##
523+
##############################################################################
524+
525+
export P, PassThrough
526+
527+
type PassThrough{T} <: AbstractVector{T}
528+
x::AbstractVector{T}
529+
end
530+
const P = PassThrough
531+
532+
size(x::PassThrough) = size(x.x)
533+
getindex(x::PassThrough, i) = getindex(x.x, i)
534+
535+
DataFrames.upgrade_vector(v::PassThrough) = v.x
536+
518537
end # module

0 commit comments

Comments
 (0)