next up previous contents index
Next: User Initialization File Up: Some Useful Shortcuts Previous: The XLISP-STAT Editor

Reading Data Files

  The data files we have used so far in this tutorial have been processed to contain XLISP-STAT expressions. XLISP-STAT also provides two functions for reading raw data files. The simpler of the two is read-data-file.   The expression

(read-data-file file)
where file is a string representing the name of the data file, returns a list of all the items in the file. Items can be separated by any amount of white space, but not by commas or other punctuation marks. Items can be any valid Lisp expressions. In particular they can be numbers, strings or symbols. The list can then be manipulated into the appropriate form within XLISP-STAT.

The function read-data-columns   is provided for reading data files in which each row represents a case and each column a variable. The expression

(read-data-columns file cols)
will return a list of cols lists, each representing a column of the file. Note that this function determines the column structure from the value of cols, not from the structure of the file. The entries of file can be as for read-data-file.

These two functions should be adequate for most purposes. If you have to read a file that does not fit into the form considered here you can use the raw file handling functions of XLISP.

Luke Tierney
Tue Jan 21 15:04:48 CST 1997