remove cybertiggyr, not trustable. clean up load, automagically.
[CommonLispStat.git] / examples / loading-data.lisp
blobacc32901b464d63e572edbb61957abf60cbec4c8
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-12-08 07:54:05 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.
16 ;; start within the common-lisp-stat-user
17 (in-package :ls-user)
19 ;; we'll be loading from directories in the CLS homedir, so we want to
20 ;; make it easier to reach.
21 (defparameter *my-cls-homedir*
22 "/home/tony/sandbox/CLS.git/" ; <- value with trailing directory separator
23 "documentation: change this to localize") ; <- doc
24 ;; so
25 (concatenate 'string *my-cls-homedir* "Data/example.csv")
26 ;; implies
27 (defun localized-pathto (x)
28 "return a string denoting the complete path.
29 FIXME: UNIX-centric (though might work on Mac OSX). Might want to
30 return a pathspec, not a string/namespec"
31 (check-type x string)
32 (concatenate 'string *my-cls-homedir* x))
36 (progn
37 ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
38 ;; The following breaks because we should use a package to hold
39 ;; configuration details, and this would be the only package outside
40 ;; of packages.lisp, as it holds the overall defsystem structure.
41 (load-data "iris.lsp") ;; (the above partially fixed).
42 (variables)
43 diabetes )
48 (progn
49 ;; Importing data from DSV text files.
51 (asdf:oos 'asdf:load-op 'rsm-string)
52 (rsm.string:file->string-table
53 (localized-pathto "Data/example-mixed.csv"))
55 (rsm.string:file->number-table
56 (localized-pathto "Data/example-numeric.csv"))
58 (defparameter *my-df-2*
59 (make-instance 'dataframe-array
60 :storage
61 (listoflist->array
62 (transpose-listoflist
63 (rsm.string:file->string-table
64 (localized-pathto "Data/example-mixed.csv"))))
65 :doc "This is an interesting dataframe-array"))
66 *my-df-2*
68 (defparameter *my-df-3*
69 (make-instance 'dataframe-array
70 :storage
71 (listoflist->array
72 (transpose-listoflist
73 (rsm.string:file->number-table
74 (localized-pathto "Data/example-numeric.csv"))))
75 :doc "This is an interesting dataframe-array"))
76 *my-df-3*
78 ;; Need to the this using the make-dataframe example, or write a
79 ;; dsvfile->dataframe command.