Skip to content

Example 3

Jonathon Love edited this page Nov 15, 2016 · 1 revision

In this example, we will add a rich table to the results.

In our earlier examples, we have been creating a Preformatted results object in the .init() function. Although it is possible to create a Table object in the same way, there is an alternative easier way to achieve the same thing. We create an example03.r.yaml file alongside the example03.a.yaml file. In this file we specify the results object for the analysis, allowing us (in many cases) to do away with the .init() function all together.

---
name: Example03
title: Example 03
api: 1

items:
    - name: ttest
      title: Independent Samples T-Test
      type: Table
      rows: 1

      columns:
        - name: var
          title: ''
          content: ''
          type: text

        - name: stat
          title: statistic
          type: number

        - name: df
          title: df
          type: number

        - name: p
          title: p
          type: number
          format: zto,pvalue

In this example, the results will have the title Example 03, and contain a single item of type Table.

    - name: ttest
      title: Independent Samples T-Test
      type: Table
      rows: 1

As can be seen, this table will be called ttest (can be retrieved in the analysis with self$results$get('ttest') or the more convenient self$results$ttest), will have the title Independent Samples T-Test, and will have a single row.

The table will have four columns:

      columns:
        - name: var
          title: ''
          content: ''
          type: text

        - name: stat
          title: statistic
          type: number

        - name: df
          title: df
          type: number

        - name: p
          title: p
          type: number
          format: zto,pvalue

each column has a name, a title, and a type. In the case of the var column, it has content of an empty string, so cells in that column will be initialized to be empty. The p column has a format of zto and pvalue (comma separated). zto indicates that this column's values range from 'zero to one', which will typically be formatted to three decimal places. pvalue indicates that this column contains p-values; should values in this column become less than .001, the string < .001 will be substituted.

Select Example 3 from the jmvexamples menu inside jamovi, and examine the results.

In the next example we will look at populating this table.

[Next >> Example 4](Example 4)

Tutorial

  • [Getting Started](Getting Started)
  • [Example 0](Example 0)
  • [Example 1](Example 1)
  • [Example 2](Example 2)
  • [Example 3](Example 3)
  • [Example 4](Example 4)
  • [Example 5](Example 5)

API

Clone this wiki locally