basic rectangular structure data construction
[CommonLispStat.git] / src / data / dataframe-xarray.lisp
blob4513d959edbfb5df9b3a3a749895c473a96bdf31
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-07-13 14:32:21 tony>
4 ;;; Creation: <2009-06-22 17:09:47 tony>
5 ;;; File: dataframe-xarray.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. BSD, LLGPL, or GPLv2, depending
8 ;;; on how it arrives.
9 ;;; Purpose: Integration of xarray tools with dataframe-like
10 ;;; objects.
12 ;;; What is this talk of 'release'? Klingons do not make software
13 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
14 ;;; designers and quality assurance people in its wake.
16 ;;; Tamas Papp's xarray package is his 2nd generation generic array
17 ;;; indexing package, coming after the ideas and thoughts behind his
18 ;;; affi package, which while novel, is somewhat obsolete.
21 (defmethod xref ((obj data-frame-like) &rest indices)
22 (apply #'dfref obj indices))
23 ;; better might be: (xref (dataset obj) indices)
25 (defmethod (setf xref) (value (object array) &rest subscripts)
26 (setf (apply #'dfref object subscripts) value))
28 (defmethod xref ((obj matrix-like) &rest indices))
30 (defmethod xtype ((obj dataframe-like))
31 "Unlike the standard xtype, here we need to return a vector of the
32 types. Vectors can have single types, but arrays have single type.
33 Dataframe-like have multiple types, variable-like single type,
34 case-like has multiple types, and matrix-like has single type.")
36 (defmethod xdims ((obj dataframe-like))
37 (dataframe-dimensions obj))
39 ;; use default methods at this point, except for potentially weird DFs
40 (defmethod xdims* ())
42 (defmethod xdim ((obj dataframe-like) index)
43 (dataframe-dimension index))
47 (defmethod xrank ())
49 (defmethod slice ())
51 (defmethod take ())
53 (defmethod carray ())