clean up CLSv2 demo to sketch through how one might do data analysis.
[CommonLispStat.git] / examples / loading-data.lisp
blobff6b03e3994f97a8ec12962d97665b8101f85010
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-04-23 07:14:56 tony>
4 ;;; Creation: <2009-03-12 17:14:56 tony>
5 ;;; File: template.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: Template header file
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
17 (progn ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
18 ;; The following breaks because we should use a package to hold
19 ;; configuration details, and this would be the only package outside
20 ;; of packages.lisp, as it holds the overall defsystem structure.
21 (load-data "iris.lsp") ;; (the above partially fixed).
22 (variables)
23 diabetes )
28 (progn ;; Importing data from DSV text files.
30 (defparameter *my-df-2*
31 (make-instance 'dataframe-array
32 :storage
33 (listoflist->array
34 (cybertiggyr-dsv::load-escaped
35 "/media/disk/Desktop/sandbox/CLS.git/Data/example-mixed.csv"))
36 :doc "This is an interesting dataframe-array"))
37 #| :case-labels (list "x" "y")
38 :var-labels (list "a" "b" "c" "d" "e")
39 |#
41 ;; a better approach is:
42 (asdf:oos 'asdf:load-op 'rsm-string)
43 (rsm.string:file->string-table
44 "/media/disk/Desktop/sandbox/CLS.git/Data/example-mixed.csv")
46 (rsm.string:file->number-table
47 "/media/disk/Desktop/sandbox/CLS.git/Data/example-numeric.csv")
49 (defparameter *my-df-2*
50 (make-instance 'dataframe-array
51 :storage
52 (listoflist->array
53 (transpose-listoflist
54 (rsm.string:file->string-table
55 "/media/disk/Desktop/sandbox/CLS.git/Data/example-mixed.csv")))
56 :doc "This is an interesting dataframe-array"))
57 *my-df-2*
59 (defparameter *my-df-3*
60 (make-instance 'dataframe-array
61 :storage
62 (listoflist->array
63 (transpose-listoflist
64 (rsm.string:file->number-table
65 "/media/disk/Desktop/sandbox/CLS.git/Data/example-numeric.csv")))
66 :doc "This is an interesting dataframe-array"))
67 *my-df-3*
69 ;; Need to the this using the make-dataframe example, or write a
70 ;; dsvfile->dataframe command.