Page 1 of 1

Table related issues

Posted: Mon Jun 12, 2023 5:50 am
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:

Re: Table related issues

Posted: Mon Jun 12, 2023 6:43 am
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

Re: Table related issues

Posted: Mon Jun 12, 2023 7:23 am
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?

Re: Table related issues

Posted: Mon Jun 12, 2023 7:29 am
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

Re: Table related issues

Posted: Mon Jun 12, 2023 7:34 am
by Hark
It worked, thanks for your help!