3 ;;; Time-stamp: <2010-06-07 13:55:13 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 "Given a string representing a relative path from the CLS home
43 directory, return a string denoting the complete path.
45 FIXME: UNIX-centric (though might work on Mac OSX). We really want to
46 return a pathspec, not a string/namespec"
48 (concatenate 'string
*cls-home-dir
* x
))
52 ;; LISP-STAT COMPATIBILITY MODE:
54 ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
55 ;; The following breaks because we should use a package to hold
56 ;; configuration details, and this would be the only package outside
57 ;; of packages.lisp, as it holds the overall defsystem structure.
58 (load-data "iris.lsp") ;; (the above partially fixed).
60 ;; FIXME above: Diabetes unbound, but it shouldn't be. I think
61 ;; we need to eliminate LispStat v1.
65 ;; COMMON LISP STATISTICS
66 ;; Importing data from DSV text files.
68 #| We use as an example a simple R datasert
, chickwts
, which has one
69 nominal categorical variable and one continuous categorical
70 variable. This dataset can be accessed in R as follows
:
77 Min. :108.0 casein :12
78 1st Qu.:204.5 horsebean:10
79 Median :258.0 linseed :12
80 Mean :261.3 meatmeal :11
81 3rd Qu.:323.5 soybean :14
82 Max. :423.0 sunflower:12
86 (defparameter *chickwts-df* (filename.dsv->dataframe (localized-pathto "Data/R-chickwts.csv")))
88 (xref *chickwts-df* 1 1) ; => 160
89 (xref *chickwts-df* 40 2) ; => "sunflower"