The order of the levels is used in graphs and tables of results. For example, if a table is calculated using one classifying factor then the first level/label of the factor will be used for the first row of the table, and so on. It doesn’t always make sense to display results in alphabetical order; for example, with species data, you would normally have a table that was in decreasing order of frequency such as:
Species | Percentage composition |
Rye grass | 79% |
Clover | 12% |
Other grass | 5% |
Plantain | 3% |
Thistles | 1% |
Genstat lets you sort on seasons, numerical prefix, by month, etc. By applying a sort order such as frequency to the raw data containing the individual species observations, when you form the summary table above you would get the groups displayed in decreasing order as you want.
You can sort the order that factor levels or labels are displayed in results using a predefined sort order, such as alphabetical, or create your own user-defined order. If you want to use a bespoke or non-standard sorting order see Reordering levels or labels.
- Place the cursor in a factor column, then from the menu select Spread | Factor | Edit Levels and Labels.
- Click Sort.
- Select a sort type from the dropdown list (see Sort type table below).
- If required, select a Starting position and Sort direction then click OK.
After you sort by labels you have to close the dialog then re-open it to see the effect of your sort.
Starting position | For predefined lists (day, months, compass points or user-defined) this gives the starting position in the list. The list is treated as circular, so for example with months, the first month by default is January, but by specifying a starting position of June the months will be sorted in the order June, July, May, etc. |
Sort direction | Specifies whether the data is sorted into ascending or descending order e.g. if you select Alphabetical/Ascending the data will be ordered from A-Z. |
Alphabetical | Sort labels alphabetically. |
Compass points | Sort the labels using the order of compass points (N, NE, E, etc.) |
Week days | Use the order of days of the week (Mon, Tue, Wed, etc.) to sort the labels. |
Month names (abbreviated) | Use the order of 3 letter month names (Jan, Feb, Mar, etc.) to sort the labels. |
Month names (full) | Use the order of full month names (January, February, March, etc.) to sort the labels. |
Seasons | Sort the labels using the order of seasons (winter, spring, summer and autumn). |
User order | Sort using the order specified on the Tools | Spreadsheet Options | Conversions tab. |
By numerical part | Read any number within the label and sort numerically on these. For example the list A2, B1, 0X, Z1.2 will sort to 0X, B1, Z1.2, A2. |
Numerical suffix | Sort numerically on whole numbers at the start of the label, and then alphabetically on the remainder of the label. For example the alphabetically sorted list 100A, 10A, 10B, 1A, 1B, 20B, 2A, will sort to 1A, 1B, 10A, 10B, 100A, 2A, 20B |
Numerical prefix | Sort alphabetically on the letters at the start of the label and then numerically on whole numbers at the end of the label. For example the list A1, A10, A100, A2, A20 will sort to A1, A2, A10, A20, A100. |
By levels | Sort numerically using the factor levels. |
By frequency | Sort according to the frequency of occurrence of each factor group in the column. |