.. index:: single: G7 Command; resector single: G7 Command; rs The Resector Command ==================== The purpose of these tools is to provide a convenient way to aggregate and disaggregate data from various sectoral levels. The routine begins by reading a file that contains concordances between various sectoral aggregation schemes. The column heading on the first line must specify the number of sectors in that aggregation scheme. This number of sectors is also the "handle" that is used to refer to that column in the resector routines. Please see the `demo section `_ of the Inforum web site for examples of the *resector* capabilities. **rs create [ ]** The *create* function opens the key file and reads in up to 20 columns of aggregation information (6 is the default). An optional argument can be supplied to limit the reading to more or less columns than the default. In principle, the routines handle aggregation or disaggregation between any two of the schemes read from the file. With six aggregation schemes, this results in 36 possible combinations of aggregation. The beginning of a sample file is displayed below:: 575 495 360 432 85 BEA82 1 1 1 1 1 10100 Dairy farm products 2 2 2 2 1 10200 poultry and eggs 3 3 3 3 1 10301 Meat animals 4 4 3 3 1 10302 Miscellaneous livestock-horses,bees,ho 5 5 4 4 1 20100 Cotton 6 6 5 5 1 20201 Food grains: wheat,rye,rice,buckwheat 7 7 5 6 1 20202 Feed grains: corn,oats,barley,hay,sorg 8 8 5 6 1 20203 Grass seeds 9 9 6 7 1 20300 Tobacco 10 10 7 8 1 20401 Fruits 11 11 7 8 1 20402 Tree nuts 12 12 7 9 1 20501 Vegetables 13 13 7 10 1 20502 Sugar crops **rs formagg ]** This is the first function that should be called after creation. It performs the most important initialization tasks. It sets up all of the information that is needed to aggregate from the scheme indicated as to the scheme indicated as . It sets up concordance lists and "split lists" that will be used by other functions listed below. In some programs, you may need to issue this command several times, especially if you need to use some of the "cross-aggregation" techniques described below. One of the functions of initialization is to set up lists of correspondences between sectors, as well as lists of splits, where one sector from one scheme corresponds to one or more sectors from the other scheme. Since this initialization is time and memory consuming, an explicit function called *formagg* performs this task, and this function is called for only needed aggregation relationships. *formagg* takes as its arguments the maximum sector numbers of the source and destination schemes. Until *formagg* has been called with a certain aggregation pair, no other functions using that pair are allowed. **rs aggvector ]** This function is designed to aggregate or split a vector from one aggregation scheme to a vector of another aggregation scheme. should be the number of sectors of the source vector, and should be the number of sectors of the destination vector, as shown in the heading in the key file that was read from the create routine. must be of the same aggregation level as the destination vector. It is used by the routine where there is a one-to-many relationship going from source to destination sectors. If you purely are aggregating, the will not be used and its values may be set to arbitrary levels. **rs ctrlvec ** This function controls a detailed vector to a more aggregate vector. **rs rdctrlvec ** This function controls a detailed vector to a more aggregate vector, using right-direction scaling. | **rs crossaggvector ** | Sometimes conversion of a sectoral scheme is more complicated than merely a combination of aggregations and splits. For example, there may exist a many-to-many relationship, where a of either sectoring level would not provide enough information on how the flows should be allocated. The name "cross-aggregation" indicates the method of translation used by this function, whereby the source vector is split to the level of a more detailed intermediary vector, which then can be aggregated directly to the destination vector. It must be possible to aggregate the intermediate sectoring level both to the source and to the destination levels for this function to work. In the argument list, is the number of sectors of the source vector, is the number of sectors of the destination vector, and is the number of sectors of the intermediary vector. is the source vector and is the destination vector. In this function, is a vector of length <> that is used to split the source vector. | **rs aggmatrows > ** | **rs aggmatrows ** | This function is similar to *aggvector* but aggregates the by row to obtain the . The routine also will accept a packed matrix as the input, though the must be a full matrix. | **rs aggmatrix ** | This function aggregates a matrix both by rows and columns. Earlier editions of the routine required both the source and destination matrix to be square, and the same aggregation mapping was applied to both dimensions. The current routine operates on rectangular matrices, and different aggregation mappings may be applied to the rows and columns. | **rs ctrlmatrows ** | **rs ctrlmatrows ** | This function controls a more detailed matrix to an aggregate matrix. | **rs ctrlmat ** | **rs ctrlmat ** | This function controls all cells within a block of the more detailed matrix to a single cell of the less detailed matrix. The function handles all of the different cases: single cell to single cell, row vector to single cell, column vector to single cell, and sub-block to single cell. The function is useful for updating a more detailed matrix such as a benchmark IO table to a more aggregate (and more current) matrix. | **rs crossaggmatrows ** | This function works much like crossaggvector but aggregates rows of a matrix.