flexmat : addrow


addrow is a sub-command of flexmat program. It adds a row to a flexmat matrix. This sub-command has three required options :

1. data(data1, data2, data3, …)

2. row(int),

3. and col(int).

The data items in the option data() should be separated by a comma or any other parsing characters such as pipe (|), semi-colon (;), etc.  If the parse character is not comma, then option parse(str) has to be used to specify the parsing character.

Let us continue writing to the same matrix that we started in the previous example example. This time, instead of writing individual cells, we shall write a complete row.
Our row will start from row number 3 and column number 1. We shall use the default parsing, i.e. comma.

* Code line 8
flexmat addrow, data(2002, 6.7, 1.6) r(3) c(1)

  0 |1              2       3 
----+-------------------------------------
  1 |Year        Mean      SD 
----+-------------------------------------
  2 |2001        5.1%    1.5% 
  3 |2002         6.7     1.6 
------------------------------------------

Explanation

In code line 8, we used the sub-command addrow. We passed on three cells of data, each cell separated by the default parsing character, that is comma. We wanted to add this data to row number 3 of the existing table, therefore, we used the option r(3) which we could have also written as row(3). We wanted the addition of the cells to start at column 1, so we wrote c(1). Since default value for both row() and col() are 1, we could have skipped the c(1) altogether. However, it is a good practice to write it to make the code more readable.

In the following code, we add one more row at row location 4.

* Code line 9
flexmat addrow, data(2003, 6.58, 1.61) r(4) c(1)

  0 |1              2       3 
----+-------------------------------------
  1 |Year        Mean      SD 
----+-------------------------------------
  2 |2001        5.1%    1.5% 
  3 |2002         6.7     1.6 
  4 |2003        6.58    1.61 
------------------------------------------

Previous : sub-command addcell        Next : sub-command addcol