This is the data-frame Reference Manual, version 1.3.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:54:17 2024 GMT+0.
data-frame/data-frame.asd
data-frame/pkgdcl.lisp
data-frame/utils.lisp
data-frame/data-frame.lisp
data-frame/pprint.lisp
data-frame/formatted-output.lisp
data-frame/summary.lisp
data-frame/defdf.lisp
data-frame/conditions.lisp
data-frame/properties.lisp
data-frame/missing.lisp
data-frame/filter.lisp
data-frame/plist-aops.lisp
The main system appears first, followed by any subsystem dependency.
data-frame
A data manipulation library for statistical computing
Data frames for Common Lisp
Steve Nunez <steve@symbolics.tech>
(GIT https://github.com/Lisp-Stat/data-frame.git)
MS-PL
A data frame is a common way of storing data for statistical analysis. Under the hood, a data frame is a vector of equal-length vectors. Each element of the vector can be thought of as a column and the length of each element of the vector is the number of rows. As a result, data frames can store different classes of objects in each column (i.e. numeric, character, factor). In essence, the easiest way to think of a data frame is as an Excel worksheet that contains columns of different types of data but are all of equal length rows.
From a design perspective, Lisp-Stat’s data frame is conceptually most similar to the ’tibble’ from the tidyverse, but using Common Lisp idioms, style and syntax.
1.3.3
alexandria
(system).
alexandria+
(system).
anaphora
(system).
array-operations
(system).
num-utils
(system).
select
(system).
statistics
(system).
let-plus
(system).
duologue
(system).
sb-cltl2
(system).
pkgdcl.lisp
(file).
utils.lisp
(file).
data-frame.lisp
(file).
pprint.lisp
(file).
formatted-output.lisp
(file).
summary.lisp
(file).
defdf.lisp
(file).
conditions.lisp
(file).
properties.lisp
(file).
missing.lisp
(file).
filter.lisp
(file).
plist-aops.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
data-frame/data-frame.asd
data-frame/pkgdcl.lisp
data-frame/utils.lisp
data-frame/data-frame.lisp
data-frame/pprint.lisp
data-frame/formatted-output.lisp
data-frame/summary.lisp
data-frame/defdf.lisp
data-frame/conditions.lisp
data-frame/properties.lisp
data-frame/missing.lisp
data-frame/filter.lisp
data-frame/plist-aops.lisp
data-frame/utils.lisp
pkgdcl.lisp
(file).
data-frame
(system).
column-type
(function).
delete-nth
(function).
delete-nth*
(macro).
get-type
(function).
types-in-column
(function).
data-frame/data-frame.lisp
utils.lisp
(file).
data-frame
(system).
*large-data*
(special variable).
add-column!
(function).
add-columns
(function).
add-columns!
(function).
alist-df
(function).
alist-dv
(function).
as-alist
(method).
as-array
(method).
as-array
(method).
axis-dimension
(method).
canonical-representation
(method).
column
(function).
(setf column)
(function).
column-names
(function).
columns
(function).
copy
(function).
count-rows
(function).
data-frame
(class).
data-type
(type).
data-vector
(class).
describe-object
(method).
df
(function).
df-remove-duplicates
(function).
dims
(method).
dims
(method).
do-rows
(function).
dv
(function).
element-type
(method).
initialize-instance
(method).
keys
(function).
make-df
(function).
make-dv
(function).
map-columns
(function).
map-df
(function).
map-rows
(function).
mask-rows
(function).
matrix-df
(function).
name
(reader method).
(setf name)
(writer method).
ncol
(method).
nrow
(method).
plist-df
(function).
plist-dv
(function).
print-object
(method).
print-object
(method).
print-object
(method).
remove-column!
(function).
remove-columns
(function).
rename-column!
(method).
replace-column
(function).
replace-column!
(function).
rows
(function).
sample
(method).
select
(method).
select
(method).
select
(method).
add-key!
(function).
add-keys
(function).
alist-data
(function).
check-column-compatibility
(generic function).
copy-ordered-keys
(function).
data
(class).
define-data-subclass
(macro).
df-env-p
(function).
ensure-arguments-alist
(function).
key-index
(function).
keys-count
(function).
keys-vector
(function).
make-data
(function).
make-ordered-keys
(function).
ordered-keys
(function).
ordered-keys
(structure).
ordered-keys-p
(function).
ordered-keys-table
(reader).
plist-data
(function).
remove-columns!
(function).
remove-key!
(function).
data-frame/pprint.lisp
data-frame.lisp
(file).
data-frame
(system).
head
(method).
print-array
(function).
print-data
(function).
short-string
(function).
tail
(method).
*max-digits*
(special variable).
*row-numbers-p*
(special variable).
2d-array-to-list
(function).
column-type-format
(function).
default-column-formats
(function).
max-decimal
(function).
max-width
(function).
printer-status
(function).
reverse-df
(function).
data-frame/formatted-output.lisp
pprint.lisp
(file).
data-frame
(system).
df-print
(function).
print-markdown
(function).
aesthetic-string
(function).
print-table
(function).
weave
(function).
data-frame/summary.lisp
formatted-output.lisp
(file).
data-frame
(system).
*distinct-maximum*
(special variable).
*distinct-threshold*
(special variable).
*quantile-threshold*
(special variable).
*summary-minimum-length*
(special variable).
bit-variable-summary
(structure).
factor-variable-summary
(structure).
generic-variable-summary
(structure).
get-summaries
(function).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
real-variable-summary
(structure).
summarize-column
(function).
summary
(function).
bit-variable-summary-count
(reader).
bit-variable-summary-desc
(function).
bit-variable-summary-length
(function).
bit-variable-summary-missing
(function).
bit-variable-summary-name
(function).
bit-variable-summary-p
(function).
column-length
(generic function).
copy-bit-variable-summary
(function).
copy-factor-variable-summary
(function).
copy-generic-variable-summary
(function).
copy-real-variable-summary
(function).
copy-variable-summary%
(function).
distinct
(function).
ensure-not-ratio
(function).
factor-variable-summary-desc
(function).
factor-variable-summary-element-count-alist
(reader).
factor-variable-summary-length
(function).
factor-variable-summary-missing
(function).
factor-variable-summary-name
(function).
factor-variable-summary-p
(function).
generic-variable-summary-desc
(function).
generic-variable-summary-element-count-alist
(reader).
generic-variable-summary-length
(function).
generic-variable-summary-missing
(function).
generic-variable-summary-name
(function).
generic-variable-summary-p
(function).
generic-variable-summary-quantiles
(reader).
make-bit-variable-summary
(function).
make-factor-variable-summary
(function).
make-generic-variable-summary
(function).
make-real-variable-summary
(function).
make-variable-summary%
(function).
monotonicp
(function).
print-count-and-percentage
(function).
real-variable-summary-desc
(function).
real-variable-summary-length
(function).
real-variable-summary-max
(reader).
real-variable-summary-mean
(reader).
real-variable-summary-min
(reader).
real-variable-summary-missing
(function).
real-variable-summary-name
(function).
real-variable-summary-p
(function).
real-variable-summary-q25
(reader).
real-variable-summary-q50
(reader).
real-variable-summary-q75
(reader).
summarize-factor-variable
(function).
summarize-generic-variable
(function).
summarize-real-variable
(function).
variable-summary%
(structure).
variable-summary%-desc
(reader).
variable-summary%-length
(reader).
variable-summary%-missing
(reader).
variable-summary%-name
(reader).
variable-summary%-p
(function).
data-frame/defdf.lisp
summary.lisp
(file).
data-frame
(system).
*ask-on-redefine*
(special variable).
defdf
(macro).
defdf-env
(function).
show-data-frames
(function).
undef
(function).
*data-frames*
(special variable).
show-symbols
(function).
data-frame/conditions.lisp
defdf.lisp
(file).
data-frame
(system).
data-frame
(reader method).
duplicate-key
(condition).
key-not-found
(condition).
large-data
(condition).
data-frame-exists
(condition).
data-size
(reader method).
df-exists-p
(function).
invalid-df-name
(function).
missing-data
(condition).
data-frame/properties.lisp
conditions.lisp
(file).
data-frame
(system).
get-property
(function).
heuristicate-types
(function).
set-properties
(function).
set-property
(function).
show-properties
(function).
data-frame/missing.lisp
properties.lisp
(file).
data-frame
(system).
drop-missing
(method).
drop-missing
(method).
ignore-missing
(function).
missingp
(generic function).
replace-missing
(method).
drop-na
(function).
data-frame/filter.lisp
missing.lisp
(file).
data-frame
(system).
filter-rows
(function).
key-list
(function).
data-frame/plist-aops.lisp
filter.lisp
(file).
data-frame
(system).
ensure-plist
(macro).
Packages are listed by definition order.
data-frame
df
alexandria
.
alexandria+
.
anaphora
.
common-lisp
.
let-plus
.
select
.
select-dev
.
*ask-on-redefine*
(special variable).
*distinct-maximum*
(special variable).
*distinct-threshold*
(special variable).
*large-data*
(special variable).
*quantile-threshold*
(special variable).
*summary-minimum-length*
(special variable).
add-column!
(function).
add-columns
(function).
add-columns!
(function).
alist-df
(function).
alist-dv
(function).
bit-variable-summary
(structure).
column
(function).
(setf column)
(function).
column-names
(function).
column-type
(function).
columns
(function).
copy
(function).
count-rows
(function).
data-frame
(generic reader).
data-frame
(class).
data-type
(type).
data-vector
(class).
defdf
(macro).
defdf-env
(function).
delete-nth
(function).
delete-nth*
(macro).
df
(function).
df-print
(function).
df-remove-duplicates
(function).
do-rows
(function).
drop-missing
(generic function).
duplicate-key
(condition).
dv
(function).
factor-variable-summary
(structure).
filter-rows
(function).
generic-variable-summary
(structure).
get-property
(function).
get-summaries
(function).
head
(generic function).
heuristicate-types
(function).
ignore-missing
(function).
key-not-found
(condition).
keys
(function).
large-data
(condition).
make-df
(function).
make-dv
(function).
map-columns
(function).
map-df
(function).
map-rows
(function).
mask-rows
(function).
matrix-df
(function).
missingp
(generic function).
name
(generic reader).
(setf name)
(generic writer).
plist-df
(function).
plist-dv
(function).
print-array
(function).
print-data
(function).
print-markdown
(function).
real-variable-summary
(structure).
remove-column!
(function).
remove-columns
(function).
rename-column!
(generic function).
replace-column
(function).
replace-column!
(function).
replace-missing
(generic function).
rows
(function).
set-properties
(function).
set-property
(function).
short-string
(function).
show-data-frames
(function).
summarize-column
(function).
summary
(function).
tail
(generic function).
undef
(function).
*data-frames*
(special variable).
*max-digits*
(special variable).
*row-numbers-p*
(special variable).
2d-array-to-list
(function).
add-key!
(function).
add-keys
(function).
aesthetic-string
(function).
alist-data
(function).
bit-variable-summary-count
(reader).
bit-variable-summary-desc
(function).
bit-variable-summary-length
(function).
bit-variable-summary-missing
(function).
bit-variable-summary-name
(function).
bit-variable-summary-p
(function).
check-column-compatibility
(generic function).
column-length
(generic function).
column-type-format
(function).
copy-bit-variable-summary
(function).
copy-factor-variable-summary
(function).
copy-generic-variable-summary
(function).
copy-ordered-keys
(function).
copy-real-variable-summary
(function).
copy-variable-summary%
(function).
data
(class).
data-frame-exists
(condition).
data-size
(generic reader).
default-column-formats
(function).
define-data-subclass
(macro).
df-env-p
(function).
df-exists-p
(function).
distinct
(function).
drop-na
(function).
ensure-arguments-alist
(function).
ensure-not-ratio
(function).
ensure-plist
(macro).
factor-variable-summary-desc
(function).
factor-variable-summary-element-count-alist
(reader).
factor-variable-summary-length
(function).
factor-variable-summary-missing
(function).
factor-variable-summary-name
(function).
factor-variable-summary-p
(function).
generic-variable-summary-desc
(function).
generic-variable-summary-element-count-alist
(reader).
generic-variable-summary-length
(function).
generic-variable-summary-missing
(function).
generic-variable-summary-name
(function).
generic-variable-summary-p
(function).
generic-variable-summary-quantiles
(reader).
get-type
(function).
invalid-df-name
(function).
key-index
(function).
key-list
(function).
keys-count
(function).
keys-vector
(function).
make-bit-variable-summary
(function).
make-data
(function).
make-factor-variable-summary
(function).
make-generic-variable-summary
(function).
make-ordered-keys
(function).
make-real-variable-summary
(function).
make-variable-summary%
(function).
max-decimal
(function).
max-width
(function).
missing-data
(condition).
monotonicp
(function).
ordered-keys
(function).
ordered-keys
(structure).
ordered-keys-p
(function).
ordered-keys-table
(reader).
plist-data
(function).
print-count-and-percentage
(function).
print-table
(function).
printer-status
(function).
real-variable-summary-desc
(function).
real-variable-summary-length
(function).
real-variable-summary-max
(reader).
real-variable-summary-mean
(reader).
real-variable-summary-min
(reader).
real-variable-summary-missing
(function).
real-variable-summary-name
(function).
real-variable-summary-p
(function).
real-variable-summary-q25
(reader).
real-variable-summary-q50
(reader).
real-variable-summary-q75
(reader).
remove-columns!
(function).
remove-key!
(function).
reverse-df
(function).
show-properties
(function).
show-symbols
(function).
summarize-factor-variable
(function).
summarize-generic-variable
(function).
summarize-real-variable
(function).
types-in-column
(function).
variable-summary%
(structure).
variable-summary%-desc
(reader).
variable-summary%-length
(reader).
variable-summary%-missing
(reader).
variable-summary%-name
(reader).
variable-summary%-p
(function).
weave
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
If non-nil, the system will ask the user for confirmation before redefining a data frame
If a string/factor variable has > *distinct-maximum* values, exclude it
If an integer variable has <= discrete values, consider it a factor
An indication that the data set is large for a particular use case.
This should be bound by a user to the maximum number of data points they consider to be ’normal’. The function can then signal a large-data warning if it is exceeded.
E.g. (let ((df:*large-data* 50000))
(handler-bind ((large-data ...
(some-data-operation ; this will signal if the data is too large
(restart-bind ...
If the number of unique reals exceeds this threshold, they will be summarized with quantiles, otherwise print frequency table
Columns are only summarised when longer than this, otherwise they are returned as is.
Define a data-frame and package by the same name.
Also defines symbol-macros for variable access, e.g. mtcars:mpg
Destructively modifies N, a SEQUENCE by removing the Nth item.
Example:
LS-USER> (defparameter *v* #(a b c d))
*V*
LS-USER> (delete-nth* *v* 1)
#(A C D)
LS-USER> *v*
#(A C D)
Modify DATA (a data-frame or data-vector) by adding COLUMN with KEY. Return DATA.
Return a new data-frame or data-vector with keys and columns added. Does not modify DATA.
Modify DATA (a data-frame or data-vector) by adding columns with keys. If a data-frame environment exists, add columns to it as well.
Return column corresponding to key.
Set column corresponding to key.
Return a list of column names in DF, as strings
Return the most specific type found in COL
Return the columns of DATA as a vector, or a selection if given (keys are resolved).
Copy data frame or vector. Keys are copied (and thus can be modified), columns or elements are copied using KEY, making the default give a shallow copy.
Count the number of rows for which PREDICATE called on the columns corresponding to KEYS returns non-NIL.
Create a package with the same name as DATA-FRAME. Within it, create a symbol-macro for each column that will return the columns value. Can also be used to remove and update the environment as the DATA-FRAME changes in destructive operations
Return SEQUENCE with the Nth item removed.
Note: DELETE-IF makes no guarantee of being destructive, so you cannot rely on this side-effect. You must SETF the original sequence to the values returned from this function, or use the modify-macro DELETE-NTH*
Print DF to *standard-output* in table format
Return a modified copy of DATA from which any element (row, if a DATA-FRAME) that matches another element has been removed
Traverse rows from first to last, calling FUNCTION on the columns corresponding to KEYS. Return no values.
Filter DATA by a predicate given in BODY
Example
(data :mtcars) ; load a data set
(head mtcars) ; view first 6 rows
;; MODEL MPG CYL DISP HP DRAT WT QSEC VS AM GEAR CARB ;; 0 Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 ;; 1 Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 ;; 2 Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 ;; 3 Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 ;; 4 Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 ;; 5 Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
(filter-rows mtcars ’(< mpg 17))
#<DATA-FRAME (11 observations of 12 variables)>
(head *) ; view first 6 rows of filtered data frame
;; MODEL MPG CYL DISP HP DRAT WT QSEC VS AM GEAR CARB ;; 0 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 ;; 1 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 ;; 2 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 ;; 3 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 ;; 4 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 ;; 5 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
Return the PROPERTY of data VARIABLE
Return a list of summaries of the variables in DF
Coerce each element of the column vectors to the most specific type in the column
Often when reading in a data set, the types will be inconsistent in a variable. For example one observation might be 5.1, and another 5. Whilst mathmatically equivalent, we want our variable vectors to have identical types. The COLUMN-TYPE function returns the most specific numeric type in the column, then coerces all the vector elements to this type
Wrap FUNCTION in a closure that removes missing values and applys FUNCTION in case any of the arguments are :MISSING, :NA or NIL to arguments. Intended for functions accepting vectors.
Return a vector of keys.
Map columns of DATA-FRAME or DATA-VECTOR using FUNCTION. The result is a new DATA-FRAME with the same keys.
Map DATA-FRAME to another one by rows. Function is called on the columns corresponding to KEYS, and should return a sequence with the same length as RESULT-KEYS, which give the keys of the resulting data frame. RESULT-KETS should be either symbols, or of the format (symbol &optional (element-type t)).
Map rows using FUNCTION, on the columns corresponding to KEYS. Return the result with the given ELEMENT-TYPE.
Return a bit-vector containing the result of calling PREDICATE on rows of the columns corresponding to KEYS (0 for NIL, 1 otherwise).
Convert a matrix to a data-frame with the given keys.
Print an array to STREAM, defaulting to *standard-output*, in a tabular format. If ROW-NUMBERS-P, print row numbers.
Print DATA-FRAME to STREAM using the pretty printer
Print data frame DF, in markdown format, to STREAM
If ROW-NUMBERS is true, also print row numbers as the first column
Modify DATA (a data-frame or data-vector) by removing COLUMN with KEY. Return DATA.
Return a new data-frame or data-vector with keys and columns removed. Does not modify DATA.
ARGS: DATA data frame
KEYS list of keys (variables) to be removed
Create a new data frame with new column KEY from data-frame DATA by replacing it either with the given column, or applying the function to the current values (ELEMENT-TYPE is used.)
Modify column KEY of data-frame DATA by replacing it either with the given column, or applying the function to the current values (ELEMENT-TYPE is used.)
Return the rows of DATA as a vector
Set the PROPERTY of each variable in DF to a value. The value is specified in the plist PROP-VALUES.
Example:
To give the variables in the mtcars dataset a unit, use:
(set-properties mtcars :unit ’(:mpg m/g
:cyl :NA
:disp in³
:hp hp
:drat :NA
:wt lb
:qsec s
:vs :NA
:am :NA
:gear :NA
:carb :NA))
Set the PROPERTY of SYMBOL to VALUE
Return up to the first newline
This is useful when docstrings are multi-line. By convention, the first line is the title.
Print all data frames in the current environment in reverse order of creation, i.e. most recently created first. If HEAD is not NIL, print the first six rows, similar to the (head) function
Return a summary struct for COLUMN
Print a summary of DF to STREAM, using heuristics for better formatting
Remove one or more data frames from the environment
PARAMS: a list of DATA-FRAMEs
Essentially reverses what DEFDF does. Returns the data frames that were removed. Don’t use this if you have a data frame bound via DEFPARAMETER.
Examples:
(undef mtcars vlcars)
data-frame-exists
)) ¶vector
) &optional predicate) ¶Remove all values from VAR that are missing according to PREDICATE.
Returns values:
1. the vector with missing values removed
2. the number of elements removed
data-frame
) &optional predicate) ¶Remove all rows from DF that are missing values according to PREDICATE
data-frame
) &optional n) ¶Return the first N rows of DF; N defaults to 6
Return a vector indicating the position of any missing value indicators. They currently are :na and :missing
data
)) ¶data
)) ¶The name of the data frame. MUST be the same as the symbol whose value cell points to this data frame. This slot essentially allows us to go ’backwards’ and get the symbol that names the data frame.
name
.
Substitute NEW, a SYMBOL, for OLD in DF
Useful when reading data files that have an empty or generated column name.
Example: (rename-column! cars ’name :||) will replace an empty symbol with ’name
data-frame
) map-alist) ¶Replace missing values with the values specified
The alist consists of a column name in the CAR and the replacement value in the CDR
Example: (replace-missing mtcarsm ’((mpg . foo)))
data-frame
) &optional n) ¶Return the last N rows of DF; N defaults to 6
data-vector
)) ¶array-operations/generic
.
data-frame
)) ¶array-operations/generic
.
ordered-keys
)) ¶select-dev
.
ordered-keys
) (slice symbol
)) ¶select-dev
.
data-frame
) stream) ¶data-vector
)) ¶array-operations/generic
.
data-frame
)) ¶array-operations/generic
.
data-frame
) &rest initargs) ¶data-frame
)) ¶array-operations/generic
.
data-frame
)) ¶array-operations/generic
.
data-vector
) stream) ¶data-frame
) stream) ¶Print DATA-FRAME dimensions and type
After defining this method it is permanently associated with data-frame objects
real-variable-summary
) stream) ¶bit-variable-summary
) stream) ¶generic-variable-summary
) stream) ¶factor-variable-summary
) stream) ¶ordered-keys
) stream) ¶data-frame
) n &key with-replacement skip-unselected) ¶Return N rows of DF taken at random.
If WITH-REPLACEMENT is true, return a random sample with
replacement (a "draw").
If WITH-REPLACEMENT is false, return a random sample without
replacement (a "deal").
If SKIP-UNSELECTED is non-NIL, do not return the elements of DF that we not part of the selection. Non-NIL by default, as the typical use case is to split a data set into training and test data sets.
select
.
data-vector
) &rest slices) ¶select
.
data-frame
) &rest slices) ¶select
.
ordered-keys
) &rest selections) ¶select
.
An operation attempted to use a key that already exists in ORDERED-KEYS
error
.
:key
An operation was attempted on a non-existant key.
A operation was requested on a data set large enough to potentially cause problems.
warning
.
Summary of a bit vector.
common-lisp
.
alexandria:array-index
0
This slot is read-only.
Summary for factor variables
list
This slot is read-only.
Summary for generic variables, i.e. those with mixed types.
Summary of a real elements (using quantiles).
common-lisp
.
real
0
This slot is read-only.
real
0
This slot is read-only.
real
0
This slot is read-only.
alexandria
.
real
0
This slot is read-only.
real
0
This slot is read-only.
common-lisp
.
real
0
This slot is read-only.
A statistical type for a data variable. All data columns must be one of these types if they are to be intepreted properly by Lisp-Stat
Global list of all data frames
Convert an array to a list of lists
Modify ORDERED-KEYS by adding KEY.
Add KEYS to ORDERED-KEYS
Return the string used to represent ‘thing‘ when printing aesthetically.
Create an object of CLASS (subclass of DATA) from ALIST which contains key-column pairs.
Return a format string for the most specific type found in sequence Use this for sequences of type T to determine how to format the column.
Return a copy of ORDERED-KEYS
Return a list of formatting strings for ARRAY
The method returns a set of default formatting strings using heuristics.
Returns T if there is environment set-up for the data frame, or NIL if there isn’t one.
Returns the number of distinct elements in COLUMN, a symbol naming a variable. Useful for formatting columns for human output.
Remove all rows from DF that are missing values. Convenience R-like function.
Recognizes the following and converts them to an alist:
plist
alist
(plist)
(alist)
(data-frame)
When REAL is a RATIO, convert it to a float, otherwise return as is. Used for printing.
Return the most specific type symbol for x
A user prompt, using DUOLOGUE, to select a valid data frame name.
Return the index for KEY.
Return a list of keys used in REST, a form
Number of keys.
Vector of all keys.
Create a DATA object from KEYS and COLUMNS. FOR INTERNAL USE. Always creates a copy of COLUMNS in order to ensure that it is an adjustable array with a fill pointer. KEYS are converted to ORDERED-KEYS if necessary.
Return the maximum number of digits to the right of the decimal point in the numbers of SEQUENCE, equal to or less than MAX-DIGITS
Return the largest printed string size of the elements of SEQUENCE, equal to or less than MAX-WIDTH
Returns T if all elements of COLUMN, a SYMBOL, are increasing monotonically Useful for detecting row numbers in imported data.
Create an ORDERED-KEYS object from KEYS (a sequence).
Create an object of CLASS (subclass of DATA) from PLIST which contains keys and columns, interleaved.
Print COUNT as is and also as a rounded percentage
Print ROWS as a nicely-formatted table.
Each row should have the same number of colums.
Columns will be justified properly to fit the longest item in each one.
Example:
(print-table ’((1 :red something)
(2 :green more)))
=>
1 | RED | SOMETHING
2 | GREEN | MORE
Print values of all the printer variables
Modify DATA (a data-frame or data-vector) by removing columns with keys. If a data-frame environment exists, add columns to it as well.
Modify ORDERED-KEYS by removing KEY.
Return DF with columns in reverse order
Show the standard properties of the variables of the data frame DF Standard properties are ’label’, ’type’ and ’unit’
Print all symbols in PKG Example: (show-symbols ’mtcars)
Return an alist of factor/count pairs
Return an object that summarizes COLUMN of a DATA-FRAME. Primarily intended for printing, not analysis, returned values should print nicely. This function can be used on any type of column, even one with mixed types
Return a summary for a float variable
Return a list of the types found in SEQ
Return a list whose elements alternate between each of the lists ‘lists‘. Weaving stops when any of the lists has been exhausted.
Check if COLUMN is compatible with DATA.
data-frame
) column) ¶Return the length of column.
vector
)) ¶large-data
)) ¶An attempt to redefine an existing data frame. Triggered if either the symbol is bound or the package exists.
error
.
:data-frame
This slot is read-only.
A variable has missing data, e.g. :na, nil
Representation of ordered keys
Ordered keys provide a mapping from column keys (symbols) to nonnegative
integers. They are used internally and the corresponding interface is
NOT EXPORTED.
TABLE maps keys to indexes, starting from zero.
structure-object
.
hash-table
(make-hash-table :test (function eq))
This slot is read-only.
Base class for summarizing variables. Summary functions take SYMBOLs, rather than values, because the symbol property lists naming the variables have meta-data, e.g. type, label, that we want to print. Not exported.
structure-object
.
common-lisp
.
alexandria:array-index
0
This slot is read-only.
fixnum
0
This slot is read-only.
string
""
This slot is read-only.
string
""
This slot is read-only.
This class is used for implementing both data-vector and data-frame, and represents an ordered collection of key-column pairs. Columns are not assumed to have any specific attributes. This class is not exported.
The name of the data frame. MUST be the same as the symbol whose value cell points to this data frame. This slot essentially allows us to go ’backwards’ and get the symbol that names the data frame.
string
nil
name
.
data-frame::ordered-keys
:ordered-keys
vector
:columns
Jump to: | (
2
A B C D E F G H I K M N O P R S T U V W |
---|
Jump to: | (
2
A B C D E F G H I K M N O P R S T U V W |
---|
Jump to: | *
C D E K L M N O Q S T |
---|
Jump to: | *
C D E K L M N O Q S T |
---|
Jump to: | B C D F G K L M O P R S T U V |
---|
Jump to: | B C D F G K L M O P R S T U V |
---|