First load Lisp-Stat, plotting libraries and data and configure the
environment. We assume you have already obtained the libraries via a package manager like clpm or quicklisp. See the installation instructions on github.
If you are a Lisp newbie and want to get started as fast as possible,
then Portacle is probably your best option. Portacle is a
multi-platform IDE for Common Lisp that includes Emacs, SBCL, Git,
Quicklisp, all configured and ready to use.
Users new to lisp should also consider going through the basic
tutorial, which guides you step-by-step
through the basics of working with Lisp as a statistics practitioner.
Experienced with Lisp
We assume an experienced user will have their own Emacs and lisp
implementation and will want to install according to their own tastes
and setup. The repo links you need are below, or you can install with clpm or
All that is needed is an ANSI Common Lisp implementation. Development
is done with Genera, CCL and SBCL. Other platforms should work, but
will not have been tested.
If you want to modify Lisp-Stat you’ll need to retrieve the
files from github and place them in a directory that is known to
ASDF. This long shell command will checkout all the required
The above assumes you have the default installation
directories. Adjust accordingly if you have changed this. If this is
the first time running Lisp-Stat, use Quicklisp to get the
From now on you can load it with:
If ASDF claims it can’t find the required systems (this might happen
the first time around), reset the system configuration with:
and try again.
If you have quicklisp installed, you can use:
If Quicklisp claims it cannot find the systems, try this at the REPL:
Quicklisp is good at managing the project depencency retrieval, but
most of the time we use ASDF because of its REPL integration. You only
have to use Quicklisp once to get the dependencies, then use ASDF for
Lisp-Stat reference manuals are generated with the
declt system. This produces
high quality PDFs, markdown, HTML and Info output. The API reference
manuals are available in HTML in the reference
section of this website; PDF and Info files that can be download from
the individual systems docs/ directory.
You can install the info manuals into the emacs help system and this
allows searching and browsing from within the editing environment. To
do this, use the
command. As an example, on my MS Windows 10 machine, with MSYS2/emacs
installs the select manual into a Lisp-Stat node at the top level of
the info tree.
You can put customisations to your environment in either your
implementation’s init file, or in a separate and load it from the
implementation’s init file. For example, I keep my customisations in
#P"~/ls-init.lisp" and load it from SBCL’s init file ~/.sbclrc in
a Lisp-Stat initialisation section like this:
Settings in your personal lisp-stat init file override the system defaults.
Here’s an example ls-init.lisp file that loads some common R data sets.
;;; Load default data sets
"Data sets loaded as part of personal Lisp-Stat initialisation. Available in every session.")
(progn;do all initialisation here
(formatt"Loading ~A" (make-symbol (symbol-namex)))
With this init file, you can immediately access the data sets in the
*default-datasets* list defined above, e.g.:
The two dots “..” at the end indicate that output has been
truncated. Lisp-Stat sets the default for pretty printer
*print-lines* to 25 rows and output more than this is truncated. If
you’d like to print all rows, set this value to nil.
Notice the column named X1. This is the name given to the column by
the import function. Note the warning that was issued during the
import. Missing columns are named X1, X2, …, Xn in increasing order
for the duration of the Lisp-Stat session.
This column is actually the row name, so we’ll rename it:
Note that your row may be named something other than X1, depending
on whether or not you have loaded any other data frames with variable
name replacement. Also note: the ‘!’ at the end of the function name
is a convention indicating a destructive operation.
We saw the dimensions above in basic information. That was a printed
for human consumption. To get the values in a form suitable for
passing to other functions, use the dims command:
(aops:dimsmtcars) ;; => (32 12)
Common Lisp specifies dimensions in row-column order, so mtcars has
32 rows and 12 columns.
Lisp-Stat generally follows the tidyverse philosophy when it comes to row names. By definition, row names are unique, so there is no point including them in a statistical analysis. Nevertheless, many data sets include row names, so we include some special handling for columns with all distinct values; they are excluded by default from summaries (and you can include it if you wish). There is no concept of independent row names as with a R data frame. A Lisp-Stat data frame is more like a tibble.
Minimum & Maximum
To get the minimum or maximum of a column, say mpg, you can use several
Common Lisp methods. Let’s see what mpg looks like by typing
the name of the column into the REPL: