Table related issues

Everything related to the development of modules in jamovi
Post Reply
Hark
Posts: 9
Joined: Mon Jun 12, 2023 5:45 am

Table related issues

Post by Hark »

I am trying to learn how to use jmvtools, and I have browsed all the tutorials on dev.

I only discovered how to create a single row in the table or automatically create multiple rows according to variables.

If I want to specify the first line as a variable and the second line as another variable, how should I write it? I don't seem to have found the corresponding syntax because the row in the table can only be followed by numbers, but I cannot name each row independently?

Thank you very much! :grinning:
User avatar
jonathon
Posts: 2627
Joined: Fri Jan 27, 2017 10:04 am

Re: Table related issues

Post by jonathon »

if you want one row per variable assigned to an option, you can just use the data binding:

https://dev.jamovi.org/tuts0201-dynamic-tables.html

or are you trying to achieve something else?

cheers
Hark
Posts: 9
Joined: Mon Jun 12, 2023 5:45 am

Re: Table related issues

Post by Hark »

Thank you very much for your reply.

Sorry, but I may not be understanding the usage of the data binding very well.

For example, I want to present option1 (type: Variable, named A) in row1 of a table, option2 (type: Variable, named B) in row2 and "A×B" in row3. How can I simply write the r.yaml statement?
User avatar
jonathon
Posts: 2627
Joined: Fri Jan 27, 2017 10:04 am

Re: Table related issues

Post by jonathon »

where there's not a simple 1:1 relationship between the number of variables and the number of rows, you'll need to resort to writing R code to construct the tables. the best way is to add a `.init()` function alongside your `.run()` function, and in there you can do things like:

self$results$table$addRow('var1')
self$results$table$addRow('var2')
self$results$table$addRow('interaction')

cheers
Hark
Posts: 9
Joined: Mon Jun 12, 2023 5:45 am

Re: Table related issues

Post by Hark »

It worked, thanks for your help!
Post Reply