-
Notifications
You must be signed in to change notification settings - Fork 1
/
api_table.Rmd
149 lines (88 loc) · 5.48 KB
/
api_table.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---
title: Table
---
This document describes the properties and methods of a jamovi table object.
The values of properties can be accessed using the `$` operator, followed by the name. For example, to retrieve the title of a table, one can go:
```
table$title
```
The methods of a table object are called using the `$` operator as well. For example:
```
table$setRow(rowKey=1, values=list(t=2.3, df=2, p=0.45))
```
## Properties
### name
a string specifying the name of the table
### title
a string specifying the title of the table
### visible
`TRUE` or `FALSE`, whether the table is visible or not
### status
a string, one of `'complete'`, `'error'`, `'inited'`, `'running'`
### rowKeys
a list of 'keys'
### state
the state
## Methods
### setStatus(status)
sets the table's status, should be one of `'complete'`, `'error'`, `'inited'`, `'running'`
### setVisible(visible=TRUE)
overrides the tables default visibility
### setTitle(title)
sets the table's title
### setError(message)
sets the table's status to 'error', and assigns the error message
### setState(object)
sets the state object on the table
### addColumn(name, ...)
adds a new column to the table, the following arguments are possible:
argument | type | details
----------------|---------|------------------------------------------
`name` | string | the name of the column
`index` | integer | the index to insert the column at. if unspecified, the column is appended.
`title` | string | the title to appear at the top of the column. if unspecified, the name is used.
`superTitle` | string | the title to appear above column titles
`visible` | `TRUE`/`FALSE` or a string | whether the column should be visible. if a string is specified, this must be a data-binding to an option.
`content` | string | either a string that will be placed in every cell, or a data-binding
`type` | string | 'integer', 'number' or 'text'; text is left aligned, numbers are right aligned, integers are formatted to zero decimal places
`format` | string | a comma separated list of values, such as 'zto', 'pvalue'
`combineBelow` | `TRUE`/`FALSE` | if TRUE, when cells in the column are contiguous, and contain the same value, the lower cells will be made blank.
### addRow(rowKey, values)
Adds a row to the table. `rowKey` is an object which uniquely identifies the row -- for many cases, simply providing the index is sufficient. `values` is a named list with the values to place in the cells of that row. The names must correspond to the column names. Not all column values must be provided, and if a blank row is desired, the values argument can be omitted entirely.
### deleteRows()
Deletes all the rows in the table
### setRow(rowKey, values)
Sets the values in an existing row. `rowKey` is a key uniquely identifying the row, and `values` is a named list of values. The names must correspond to the column names. Not all column values need to be provided.
Note that you must explicitly name the rowKey argument: `setRow(rowKey=...)` to differentiate from `setRow(rowNo=...)`.
### setRow(rowNo, values)
Sets the values in an existing row. `rowNo` is a number specifying the row number, and `values` is a named list of values. The names must correspond to the column names. Not all column values need to be provided.
Note that you must explicitly name the rowNo argument when calling this method: `setRow(rowNo=...)` to differentiate from `setRow(rowKey=...)`.
### addFormat(rowKey, col, format)
### addFormat(rowNo, col, format)
Adds additional formatting to a cell. `col` can be an index or a name. format can be one of:
- `Cell.BEGIN_GROUP`
- `Cell.END_GROUP`
- `Cell.BEGIN_END_GROUP`
- `Cell.NEGATIVE`
Cell.BEGIN_GROUP adds additional padding above the cell. Cell.END_GROUP adds additional padding below the cell. Cell.NEGATIVE colours the value red.
### setCell(rowKey, col, value)
### setCell(rowNo, col, value)
Sets the value of a cell. Generally setRow() is more efficient.
### getCell(rowKey, col)
### getCell(rowNo, col)
Retrieves a cell.
### addFootnote(rowKey, col, note)
### addFootnote(rowNo, col, note)
Adds a footnote to the cell.
### addSymbol(rowKey, col, symbol)
### addSymbol(rowNo, col, symbol)
Adds a symbol to a cell -- for example an asterisk denoting significance.
### setNote(key, note, init=TRUE)
setNote() adds (or clears) a note placed in the footer of the table.
- `key`: a string identifying the note
- `note`: a string representing the text of the note (or NULL)
- `init`: whether this be considered an `init` note
Specifying a `note` of NULL causes the note to be removed.
`init` notes are those that are added during the *init* phase. `init` notes are typically based on the values of the options. For example, if the user has specified an alternative hypothesis --- that population one is greater than population two --- the analysis could add a note indicating this. In contrast, `non-init` notes are created in the *run* phase. An example might be the number of subjects that were excluded from the analysis as a result of containing missing values. `init` notes are typically based on the values of options, where as `non-init` notes depend on the data.
In practice, when an analysis is changed or re-run, `init` notes are not restored from state; they are simply recreated during the `init` phase. In contrast, `non-init` notes are restored from state.
Note that if the text of the note will always be the same, it is recommended to set the note in the `.r.yaml` file instead.