Table2Base: Difference between revisions
Juha Villman (talk | contribs) No edit summary |
(→Usage: Remove separation into index and location variables? + Define unit for each variable) |
||
Line 35: | Line 35: | ||
*Each row must have equal number of columns | *Each row must have equal number of columns | ||
*Table caption is a link to Base UI | *Table caption is a link to Base UI | ||
{{attack|1 | The t2b functionality is important. However, the distinction of variables into "index" ja "location" types is ambiguous and arbitrary. E.g. in the dataset... | |||
* municipality, last name, first names, sex, height, weight, blood group | |||
... at least the variables "municipality", "sex", and "blood group" (and in principle any of the other variables too) could be treated equally well as either "index" or "location" type. ⇒ Thus, I suggest that all variables be treated alike in the t2b syntax.|--[[User:Erkki Kuusisto|Erkki Kuusisto]] 15:22, 21 May 2012 (EEST)}} | |||
{{attack|2 | It is important that the "unit" can be defined separately for each variable. E.g. for weight and height in the sample dataset above. |--[[User:Erkki Kuusisto|Erkki Kuusisto]] 15:22, 21 May 2012 (EEST)}} | |||
{{comment|3 | Thus I suggest a simplified syntax for t2b: | |||
<nowiki><t2b variables_and_units=" | |||
var_name_1, var_unit_1, | |||
var_name_2, var_unit_2, | |||
..., | |||
var_name_N, var_unit_N "> | |||
</nowiki><br><br><nowiki> | |||
An example with the above dataset: | |||
</nowiki><br><br><nowiki> | |||
<t2b variables=" | |||
municipality, , | |||
last name, , | |||
first names, , | |||
sex, , | |||
height, cm, | |||
weight, kg, | |||
blood group, , | |||
"> | |||
</nowiki> |--[[User:Erkki Kuusisto|Erkki Kuusisto]] 15:22, 21 May 2012 (EEST)}} | |||
<br> '''Hints for spreadsheet software''' | <br> '''Hints for spreadsheet software''' |
Revision as of 12:22, 21 May 2012
Moderator:Juha Villman (see all) |
|
Upload data
|
Table2Base is an extension which enables direct upload of data from wikipages to Opasnet Base. Data is displayed as a table in wikipage.
Usage
Example:
<t2b index="Year,Country" unit="#" obs="Mortality"> 2001|Finland|1000 2002|Finland|100 2001|Sweden|600 2002|Sweden|800 </t2b>
Displays:
Obs | Year | Country | Mortality |
---|---|---|---|
1 | 2001 | Norway | 1000 |
2 | 2002 | Finland | 100 |
3 | 2001 | Sweden | 600 |
4 | 2002 | Sweden | 800 |
Notes:
- index argument defines indices of the datatable:
- example has 2 indices: Year and Country
- it is obligatory to have at least 1 index
- unit defines the unit of the variable
- it is obligatory to define unit
- obs defines the name of the result column
- obs is optional
- if not defined default value "Result" is used
- Data is saved only when table is altered and page is saved
- Number of data columns must match to number of indices + result column
- Each row must have equal number of columns
- Table caption is a link to Base UI
⇤--1: . The t2b functionality is important. However, the distinction of variables into "index" ja "location" types is ambiguous and arbitrary. E.g. in the dataset...
- municipality, last name, first names, sex, height, weight, blood group
... at least the variables "municipality", "sex", and "blood group" (and in principle any of the other variables too) could be treated equally well as either "index" or "location" type. ⇒ Thus, I suggest that all variables be treated alike in the t2b syntax. --Erkki Kuusisto 15:22, 21 May 2012 (EEST) (type: truth; paradigms: science: attack)
⇤--2: . It is important that the "unit" can be defined separately for each variable. E.g. for weight and height in the sample dataset above. --Erkki Kuusisto 15:22, 21 May 2012 (EEST) (type: truth; paradigms: science: attack)
----3: . Thus I suggest a simplified syntax for t2b:
<t2b variables_and_units="
var_name_1, var_unit_1,
var_name_2, var_unit_2,
...,
var_name_N, var_unit_N ">
An example with the above dataset:
<t2b variables="
municipality, ,
last name, ,
first names, ,
sex, ,
height, cm,
weight, kg,
blood group, ,
">
--Erkki Kuusisto 15:22, 21 May 2012 (EEST) (type: truth; paradigms: science: comment)
Hints for spreadsheet software
If you have your data table in Open Office Calc, Excel, or some other software, you can use these formulas to convert tables into Table2Base code. This example is for Excel, other software may have slightly different syntax. Here, the data is in the spreadsheet in columns A...D. Columns A...C contain index values and column D observations. The first row contains index names and rows starting from row 2 contain data.
- Formula for the first row
- ="<tb2 index="&CHAR(34)&A1&","&B1&","&C1&CHAR(34)&" unit="&CHAR(34)&"kg"&CHAR(34)&" obs="&CHAR(34)&D1&CHAR(34)&">"
- Formula for the second row and beyond
- =A2&"|"&B2&"|"&C2&"|"&D2
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>