3 ;;; Time-stamp: <2009-12-21 12:29:49 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
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.
15 ;; start within the common-lisp-stat-user
16 (in-package :cls-user
)
18 ;; we'll be loading from directories in the CLS homedir, so we want to
19 ;; make it easier to reach.
20 (defparameter *my-cls-homedir
*
21 "/home/tony/sandbox/CLS.git/" ; <- value with trailing directory separator
22 "documentation: change this to localize") ; <- doc
24 (concatenate 'string
*my-cls-homedir
* "Data/example.csv")
26 (defun localized-pathto (x)
27 "return a string denoting the complete path.
28 FIXME: UNIX-centric (though might work on Mac OSX). Might want to
29 return a pathspec, not a string/namespec"
31 (concatenate 'string
*my-cls-homedir
* x
))
36 ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
37 ;; The following breaks because we should use a package to hold
38 ;; configuration details, and this would be the only package outside
39 ;; of packages.lisp, as it holds the overall defsystem structure.
40 (load-data "iris.lsp") ;; (the above partially fixed).
48 ;; Importing data from DSV text files.
50 (rsm.string
:file-
>string-table
51 (localized-pathto "Data/example-mixed.csv"))
53 (rsm.string
:file-
>number-table
54 (localized-pathto "Data/example-numeric.csv"))
57 (defparameter *my-df-2
*
58 (make-instance 'dataframe-array
60 (listoflist:listoflist-
>array
61 (rsm.string
:file-
>string-table
62 (localized-pathto "Data/example-mixed.csv")))
63 :doc
"This is an interesting dataframe-array"))
67 (defparameter *my-df-3
*
68 (make-instance 'dataframe-array
70 (listoflist:listoflist-
>array
71 (rsm.string
:file-
>number-table
72 (localized-pathto "Data/example-numeric.csv")))
73 :doc
"This is an interesting dataframe-array"))
76 ;; Need to the this using the make-dataframe example, or write a
77 ;; dsvfile->dataframe command.
80 (defparameter *tmp-csv-filedata
* (rsm.string
:file-
>number-table
81 (localized-pathto "Data/example-numeric.csv")))
82 (defparameter *tmp-csv-filedata
* (rsm.string
:file-
>number-table
83 (localized-pathto "Data/R-chickwts.csv")
85 (defparameter *tmp-var-name-list
* (car *tmp-csv-filedata
*))
86 (defparameter *tmp-data-list
* (cdr *tmp-csv-filedata
*))
87 (defparameter *tmp-data-array
* (listoflist:listoflist-
>array
(cdr *tmp-csv-filedata
*)))
88 (aref *tmp-data-array
* 0 2)
89 (aref *tmp-data-array
* 1 1)
90 (aref *tmp-data-array
* 4 0)
92 (defparameter *test-df
*
93 (let ((csv-file-data (rsm.string
:file-
>number-table
94 (localized-pathto "Data/R-chickwts.csv")
96 (let ((var-name-list (car csv-file-data
))
97 (data-list (listoflist:listoflist-
>array
(cdr csv-file-data
))))
98 (make-instance 'dataframe-array
100 :var-labels var-name-list
101 :doc
"This is an interesting dataframe-array"))))
106 (defparameter *testdf-2
* (filename.dsv-
>dataframe
(localized-pathto "Data/R-chickwts.csv")))