XDATA MANUAL
===============================================================

The column sizes may be dynamically resized by pressing the 
Shift-Button2 combination when over a column boundary, similar 
to the behaviour of some popular spreadsheets.

There is no undo function. 

The spreadsheet is statically allocated at start-up. If you read a dataset
that is too large, xdata will crash. To change the array size, edit the
~/.xdata/xdata.ini file in your home directory.

The xdata.ini file also sets the default screen size (in pixels), the
printer command, print file, and the text in the buttons at the left 
of the screen.

Compiling Xdata
---------------

To compile xdata, type 

  configure
  make  
  make install
  
Xdata requires the following libraries:

  motif 
  libXbae
  libgmp

Bison and g++ are required for compiling. Do not run flex on the file
calculator.l. This will trash the file. Refer to the comments in calculator.y
if this happens.
  
OpenMotif 2.3.1 is recommended. Do not use Xbae version 4.60.2 - it has a 
bug in backspace. Use version 4.60.4 instead.


Command line interface
----------------------

To execute a single command, move the cursor to that line and press Ctrl-Enter
or click on Execute.

To execute a sequence of commands of lines, they must be enclosed in
braces, for example
   { 
   command 1
   command 2
   }
Move the cursor to the opening brace and press Ctrl-Enter or click on
Execute. All the commands between braces will be executed.

Command syntax
--------------

If no cells are selected, simple math commands (e.g., +, -, /, *, ramp, etc)
act on a single column. If cells are selected, these math commands will act 
only on the selected cells. Selected cells need not be in  the same column.

To select cells, click and drag on the spreadsheet. The selected cells will
be highlighted in reverse video. Clicking again anywhere will deselect all
the cells.

Cells can be selected in the editor using the select command. The syntax is
    select start-row start-col end-row end-col
for example
    select 4 1 11 1
selects rows 4 to 11 in column 1.

Some commands, such as Fourier transform, make no sense to be applied to a
selection and operate only on columns.

In the command editor, if cells are selected you don't need to specify them
in the command. If no cells are selected, you must specify which column the
command is to be applied to. For example:

    If cells are selected 
    + 33      = adds the value 33 to the selected cells
    + 22 +11  = adds the value 33 to the selected cells
    +         = adds a number. You are prompted to enter the number
    add       = adds a number. You are prompted to enter the number
    
If no cells are selected, the syntax is the same except the column 
number must be specified.

    + 1 33      = adds the value 33 to column 1
    + 1 22 +11  = adds the value 33 to column 1
    +           = adds a number. You are prompted to enter the column no. and the number
    add         = adds a number. You are prompted to enter the column no. and the number
 
 There is also an equation syntax, which always starts with a 'y' and always
 works on columns.
    y1 = 33     = sets all the values in column 1 to 33
    y = 33      = sets all the values to 33. You are prompted to enter the column
    y23 = x+4/2 = sets the values in column 23 to the row number (=the index x)
                  plus 2, i.e. 3,5,7,... . Normal operator precedence rules
                  apply.

Logic operators are also supported
    y1 = x%1
    y1 = y2 & (y23==6)
    etc
    
A column must be defined before it can be operated on. This is done to prevent
you from accidentally giving commands to non-existent columns.

To define a column, either read a data file into xdata, or type some numbers
in a column, or use the length command to create a column. Example: 
    l 3 44   = creates column 3 and sets the length to 44

All empty values are set to 0 when the spreadsheet is saved in such a way as
to keep the array square. 

Non-formula commands do not use mathematical operators or parentheses. For example:
    l 1 234  = creates column 1 with length 234
    ramp 1   = sets column 1 to integers

Strings
-------

A cell can be defined as a string by toggling the 'String' button. Anything
you type into a cell while the string button is depressed becomes a string
and cannot be changed by a math operation. Strings may have spaces and can
be up to 256 characters in length. A string cell is highlighted in 
dark blue-green.

If you type in a cell, regardless of whether it's marked as a string, while the 
string button is 'off', the cell becomes a number. If you type in a cell 
while the string button is 'string', the cell becomes a string. 

Formulas
--------

Click on the desired cell to use as a formula. Then click the Formula button 
to enter a formula in that cell. Formulas are updated automatically whenever
a command or menu option is executed.

Unlike in Excel, a formula does not start with an equals sign. So far there
are only 2 formula commands: sum and sumsq. Formulas must be enclosed in 
parentheses.

Examples:
    sum(4 5 : 6 7) = adds the values between row 4, col 5 and row 6, col 7
    sum(x[4][5] : x[6][7]) = adds the values between row 4, col 5 and row 6, col 7
    
A formula cell is highlighted in light green.

If you use a range of cells in a formula, make sure the cell containing the
formula is not within that range. Otherwise it will be included in the
calculations and will increase each time the spreadsheet is recalculated.

A formula can contain any valid command. 

Long integers
-------------
Some functions (factorial, combinations, and permutations) use the long integer 
library, which creates extremely big numbers that can't be represented in the
spreadsheet. Thus, when you type fac(500) in a cell or in the formula editor, 
it is converted to inf (infinity) in the spreadsheet. The correct answer 
(1.22014e+1134) is printed on the terminal screen.

Graphs
------
Clicking on the Graph button invokes gnuplot, which produces a graph. 
You can also have the graph saved as a PostScript file. Only x-y plots
are supported. You must enter the column numbers to be used as x and y.
Graphs are updated automatically if the numbers in either of those two
columns change.



Command List
------------

Commands are usually the same as the menu item except that spaces are
removed. Any of these commands are valid in the Formula Editor or as
Formula Cells, but not all of them make sense to use. For example, "left",
which moves the cursor left, would not be useful in a formula. Some othere 
just open a dialog box.

abouttheprogram
addcolumn
bin
bintotal
binaverage
copy
decimate
define
delete
deletecolumn
deselect
down
erase
errorpropagation
errorpropagationsetvalue
errorpropagationfrommean
errorpropagationratio
errorsets
evaluatecell
export
findintegerdifferences
help
hex
insert
length
left
linkedsort
load
find
max
min
move
msmstotic
numlock
paste
pipe
print
quit
read
reload
refresh
removespikes
right
save
select
selectcolumn
setformula
settonumber
settostring
sort
string
swap
unselectcolumn
up

c   = copy column
m   = move column
i   = insert a blank cell
l   = set length of a column
q   = quit
r   = read data file
s   = save
x   = delete selected cells


combinese
combinese3
chisq1
chisq2
chisq3
ftest
anova
mannwhitney
poisson
poisson2
poisson3
rowstats
stat
tptest
ttest1
ttest2
ttestunequal
ttestfrommean1
ttestfrommeanse1
ttestfrommean2
ttestfrommeanse2


add
areaundercurve
cbrt
comb
cos
differentiate
div
divide
evaluate
ex
expand
exp
exponentiate
exponential
fact
findpeaks
formula
fft
graph
integrate
inverse
linreg
log
log10
lr
mul
multiply
n
neg
negatives
nlr
normalize
normalizemax
pageup
pagedown
perm
pkc
ram
ramp
ran
rand
random
reformatdif
reformatmassspec
replacewithmean
shr
shrink
sin
smo
smooth
sqr
sqrt
sub
subtract
baseline
subtractbaseline
tan
t       = set title of a column
title
ungraph
wavelet

+
^  = exponentiate
/
1/x
*
10^x
-
