3 ;;; Time-stamp: <2010-02-10 14:07:45 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.
17 (cl:defpackage
:cls-examples
;; similar setup to cls-user, without test data
20 :common-lisp-statistics
)
21 (:shadowing-import-from
:lisp-stat
22 call-method call-next-method
24 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
25 asin acos atan sinh cosh tanh asinh acosh atanh float random
26 truncate floor ceiling round minusp zerop plusp evenp oddp
27 < <= = /= >= > > ;; complex
28 conjugate realpart imagpart phase
29 min max logand logior logxor lognot ffloor fceiling
30 ftruncate fround signum cis
33 (:export localized-pathto
36 ;; start within the cls-examples package, which is similar to cls-user
37 (in-package :cls-examples
)
39 ;; we'll be loading from directories in the CLS homedir, so we want to
40 ;; make it easier to reach.
41 (defun localized-pathto (x)
42 "return a string denoting the complete path.
43 FIXME: UNIX-centric (though might work on Mac OSX). Might want to
44 return a pathspec, not a string/namespec"
46 (concatenate 'string
*cls-home-dir
* x
))
50 ;; LISP-STAT COMPATIBILITY MODE:
52 ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
53 ;; The following breaks because we should use a package to hold
54 ;; configuration details, and this would be the only package outside
55 ;; of packages.lisp, as it holds the overall defsystem structure.
56 (load-data "iris.lsp") ;; (the above partially fixed).
61 ;; COMMON LISP STATISTICS
62 ;; Importing data from DSV text files.
64 #| We use as an example a simple R datasert
, chickwts
, which has one
65 nominal categorical variable and one continuous categorical
66 variable. This dataset can be accessed in R as follows
:
73 Min. :108.0 casein :12
74 1st Qu.:204.5 horsebean:10
75 Median :258.0 linseed :12
76 Mean :261.3 meatmeal :11
77 3rd Qu.:323.5 soybean :14
78 Max. :423.0 sunflower:12
82 (defparameter *chickwts-df* (filename.dsv->dataframe (localized-pathto "Data/R-chickwts.csv")))
84 (xref *chickwts-df* 1 1) ; => 160
85 (xref *chickwts-df* 40 2) ; => "sunflower"