Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

First draft of zoo functionality. #62

Merged
merged 12 commits into from

2 participants

@ejackson
Collaborator

Summary

This request contains the basis for a timeseries datatype utilising the incanter.core.Dataset type as its core type. This is intended as a first draft to demonstrate the idea and provide a basis for discussion and improvement.

Functionality

  • Core

    • zoo : This constructs a zoo type from a Dataset. It is passed a column to treat as the time index, coerces all values in column to date-time, renames the column to :index and orders the Dataset by :index.
    • $$ : This time slices the zoo. It accepts as time arguments anything that can be coerced to date-time. It accepts either one or two time arguments, outputting either a single row or all rows within the interval formed by the arguments, respectively.
  • Utilities

    • lag : lags a timeseries by a number of units of the frequency of the series. Maintain the total length of the series by inserting rows, where each column contains nils, at the top to compensate.
    • aligned? : predicate to indicate whether the timeseries passed in have exactly the same :index columns.
    • within-zoo? : predicate to indicate whether the passed in value, which must be coercible to date-time, falls within the interval spanned by the zoo. Does not need to be an existing index.
    • coredata: Return the :rows, with :index dissoc'd. Mainly used internally, but useful enough to expose.
  • Mapping functions

    • zoo-apply : applies a function to a column of a zoo, returning a zoo of the same length containing only :index and the selected column. Unlike transform-col in incancer-core, which is similar, this does not operate element-wise down the column passes the entire column to roll-apply.
    • zoo-row-map : maps a function row-wise over any number of zoos.

Questions:

  • It may be sensible to revisit the core datatype to achieve performance. Initially it is useful to be based on Dataset so as to integrate with the rest of Incanter.
  • The *-apply and *-map functions are probably misnamed. This matches R's naming convention for such functions, but clashes with Clojure's which we should respect.
@otfrom otfrom was assigned
@otfrom otfrom merged commit a58621d into incanter:master
@otfrom otfrom was unassigned by ejackson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 7, 2012
  1. @ejackson
Commits on Feb 8, 2012
  1. @ejackson

    Added zoo-apply

    ejackson authored
Commits on Feb 9, 2012
  1. @ejackson

    Added parameter to lag.

    ejackson authored
  2. @ejackson
  3. @ejackson
Commits on Feb 10, 2012
  1. @ejackson

    Added a TimeCoercible Protocol. This coerces String, Longs and Jodas

    ejackson authored
    into Jodas.  This allows us to transparantly use any of these for the
    :index in the data passed into the zoo constructor, or the indices in
    $$.
  2. @ejackson

    Allow user to specifiy which column of dataset is to be used to from

    ejackson authored
    :index in the zoo constructer function.
Commits on Feb 11, 2012
  1. @ejackson

    Added sort functionality.

    ejackson authored
Commits on Feb 12, 2012
  1. @ejackson
Commits on Feb 15, 2012
  1. @ejackson
  2. @ejackson

    Local repo.

    ejackson authored
Commits on Feb 18, 2012
  1. @ejackson
Something went wrong with that request. Please try again.