Branch creator

From Opasnet
Jump to: navigation, search


How to create a branch for handprinter?


Step 1: Create a page for branch

If the branch that you are working with already has a page, open the page for editing and go to step 2.

Open two copies of this page to your browser. Give a name to your branch and click to create a new page for it. On the other page, continue from step 2.

<createbox> break=yes width=50 buttonlabel=Create branch align=left </createbox>

Step 2: Fill in data about your branch

In step 2, you can create a new branch page or add more ovariables to an existing page. Fill in the forms below, click to create content for the page, and copy-paste that onto the page you created in step 1. You can create the main content of an entire branch page, a new ovariable that takes data as input, and a new ovariable that takes a formula as input.

Each branch is a model that consists of sub-models called ovariables. If you don´t know what they are, you should first read pages Ovariable and Modelling in Opasnet.

If you need more ovariables for your branch model, you can simply rerun this code. Just remember to copy-paste the previous content first, as it will be replaced by the new ovariables. Each ovariable has its own sub-heading under the heading "Rationale".

This is a brief description of input. For details, see the linked pages.

Branch name
Name of the page where the content and code goes. This name may contain several words and spaces, and it is recommended that it has the word 'branch' in it.
Names of ovariables
Name of a new ovariable must be a single word with no spaces. It may contain numbers and '_' and '.'. Preferably it is short but easily understandable.
Output variable
The final ovarable in your branch model. Other ovariables are used as inputs for this ovariable.
The unit of measurement that is used for the input data.
Data table
Data used by the data ovariable. It is a copy-pasted table where the first row contains the names of the columns and all other rows are the data. There must be one or more result columns, i.e. columns that contain the actual result of the ovariable; all other columns either define the scope of the result (index columns) or describe the content of the row (description columns).
  • There are three ways to define the result column(s): (i) the name of the column is "Result", (ii) the result column names have two parts separated by colon (see details below), (iii) if result column has not been defined, the last column is used as the result column.
  • All columns left from the result column(s) are treated as index columns. All columns right from the result column(s) are treated as description columns.
  • There can be several result columns so that each column is about a specified location, e.g. a year. Then the result column names must be divided into two parts by a colon so that the index is the first part and location is the second, e.g. Year:2010, Year:2011, Year:2013 and so on. For details, see Table2Base and Table2Base2.
Rationale for data and formula ovariables
Rationale is any free-text description of the ovariable to make it more understandable and reasoned.
Dependencies of ovariable
It is a copy-pasted table that must contain column 'Name' and may contain columns 'Ident' or 'Key'. Name lists the names of all ovariables that are needed to calculate the result of this ovariable. Ident tells the name of the codes that were used to save the ovariables and it is of format 'Op_en1234/codename' where the first part is the page identifier and the second part is the name of the code. For details, see R-tools.
Formula of ovariable
It is an R function (a particular kind of software code) that uses the dependencies and produces an output for this ovariable. You need to know something about R and ovariables to be able to use this effectively. In brief, the code starts where all input variables have already been loaded and calculated, and ends with 'return(out)' where out is the output for this ovariable.

Do you want to create content for a new branch page?:

Do you want to create content for a new ovariable with data?:

Do you want to create content for a new ovariable with a formula?:

What was the branch name again?:

Content for a new branch page

What again is the name of the ovariable that is the final outcome of the branch?:

Content for a new ovariable with data

Give a short name (no spaces!) for an ovariable with data:

What is(are) the unit(s) of the data?:

Give a data table for the input variable.:


Give free-text rationale about what the data ovariable is and where the data comes from.:

Content for a new ovariable with formula

Give a short name (no spaces!) to an ovariable with a formula.:

What are the input (parent or upstream) ovariables for this ovariable?:


What is the formula that defines the calculations with the parents?:

Give free-text rationale about what the outcome variable is and how it is calculated.:

+ Show code

Step 3. Finalize the page

In step 2, page content is compiled. You can rerun the step 2 code as many times as you need to define all the ovariables. Remember to copy-paste the outputs each time to the branch page.

In the end, you have to adjust the page content, because for security reasons some character combinations are not allowed in code output. In the text produced, there is a character "¤" where there should be "<". So, you should find and replace "¤" with "<" (use the button at the top-right corner of the edit window). Then you can save your page.

See also

Related files