Avtor sekcije: Jonathon Love
Assign results to tables (in R)
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$titleThe 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))
Property
Description
nameA string specifying the name of the table.
titleA string specifying the title of the table.
visibleWhether the table is visible or not (
trueorfalse, default:true).
statusThe status of the table. A string, one of
complete,error,inited,running.
rowKeysA list of ‘keys’.
stateThe state of the table.
Method
Description
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.
addRow(rowKey, values)Adds a row to the table.
rowKeyis an object which uniquely identifies the row – for many cases, simply providing the index is sufficient.valuesis 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. A more detailed description of possible values is given in the table below.
deleteRows()Deletes all the rows in the table.
setRow(rowKey, values)setRow(rowNo, values)Sets the values in an existing row.
rowKeyis a key uniquely identifying the row,rowNois a number specifying the row number. Either of these two options has to be used.valuesis a named list of values. The names must correspond to the column names. Not all column values need to be provided.
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.
addFormat(rowKey, col, format)addFormat(rowNo, col, format)Adds additional formatting to a cell.
colcan be an index or a name. Format can be one of:Cell.BEGIN_GROUP,Cell.END_GROUP,Cell.BEGIN_END_GROUPor Cell.NEGATIVE`.Cell.BEGIN_GROUPadds additional padding above the cell,Cell.END_GROUPbelow. Cell.NEGATIVE colours the value red.
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.keyis a string identifying the note,noteis a string representing the text of the note (or NULL),initindicates whether this be considered aninitnote. Specifying anoteof NULL causes the note to be removed.initnotes are those that are added during the init phase.initnotes are typically based on the values the options. For example, if the user has specified an alternative hypothesis — that population one is greater than of population two — the analysis could add a note indicating this. In contrast,non-initnotes 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.initnotes are typically based on the values of options, where asnon-initnotes depend on the data. In practice, when an analysis is changed or re-run,initnotes are not restored from state; they are simply recreated during theinitphase. In contrast,non-initnotes 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.The following arguments are possible for
addColumn:
Argument
Type
Description
namestring
The name of the column
indexinteger
The index to insert the column at. If unspecified, the column is appended.
titlestring
The title to appear at the top of the column. If unspecified, the name is used.
superTitlestring
The title to appear above column titles.
visible
TRUE/FALSE/ stringWhether the column should be visible. If a string is specified, this must be a data-binding to an option.
contentstring
Either a string that will be placed in every cell, or a data-binding.
typestring
integer,numberortext;textis left aligned,numberis right aligned,integeris formatted to zero decimal places.
formatstring
A comma separated list of values, such as
zto,pvalue.
combineBelow
TRUE/FALSEIf
TRUE, when cells in the column are contiguous and contain the same value, the lower cells will be made blank.Opozorilo
Note that you must explicitly name either the
rowNoor therowKeyargument when calling this method:setRow(rowNo = ...) setRow(rowKey = ...) setCell(rowKey = ..., col, value) setCell(rowNo = ..., col, value) addFormat(rowKey = ..., col, format) addFormat(rowNo = ..., col, format)to differentiate between the
rowKey=...and therowNo=...argument.