7.4 Creating New Columns

New columns can be added to the Spreadsheet that can calculate new data based on molecular properties or based on the existing data in the Spreadsheet. To create new columns, click on the Data menu and select the ``Create Column" option. A wizard dialog will appear to assist in the process of defining the desired expression. This dialog can be seen in Figure 7.2.

Column expressions are arbitrary functions that are evaluated using data from the row the expression is evaluated. For example, if there is a column PLP and several rows in the spreadsheet, the expression for each row will be evaluated with a different value of PLP.

Figure 7.2: The initial Create Column dialog (a) followed by inserting a math function into the expression (b).
 
[Creating a new column] createcolumn.png [Using Math Functions] createstupidcolumn.png

The column name can be entered into the dialog or the suggested name can be used if desired. Various functions can be added to the column expression using the pulldown menus. The Math pulldown provides standard math and trigonometric functionality. The Functions pulldown provides molecular functions such as molecular weight, the number of atoms, etc. The Column pulldown provides access to Spreadsheet data from other columns in the same row.

When a pulldown function requires additional input such as a trigonometric function like cos (cosine), the cursor in the text window will automatically be placed inside the function. Functions can be combined with standard math operators such as +, -, * and .

As a simple example, load a datafile and open the Create Column dialog. Enter a new column name such as ``My New Column". Now select the cos function from the Math pulldown. Notice that in Figure 7.2(b), the cursor is inside the ``cos( )" function and also notice that this expression as written cannot be evaluated as the Test window at the bottom now reads ``cos() takes exactly 1 argument (0 given)".

Now, select the ID option from the Columns pulldown menu. As seen in Figure 7.3, the column specifier ``COL(``ID")" has been placed inside the cos function and that the Test evaluation now has a value. This value is computed from the currently selected row or the first row in the spreadsheet of there is no current selection.

Figure 7.3: Referencing columns
 
createstupidcolumn2.png

Now hit the Create button to create the row in the Spreadsheet. The Cancel button can also be pushed if a new column is no longer desired.


Subsections