Page 1 of 1

Save computed vars to jamovi, using Rj or similar

Posted: Fri Sep 16, 2022 11:09 pm
by anbech
Hi

What would be the best way to define recurring recoding / computations outside of jamovis compute/recode UI, and have the resulting variables saved into jamovi's spreadsheet data frame?

I have tried using the Rj (Rj+) module, but I can't figure out a way to save new variables back into jamovi (maybe Rj cannot write data). It seems Rj only provides me with a copy of the data frame. I'm not very experienced in R, so I might have overlooked the obvious R command to use.

Preferably I would like at method that would be easily accessible to students, e.g. like Rj, so they don't have to leave jamovi for the task.

--

Side note: a big thanks to the developers/contributors. We just switched from SAS-jmp to jamovi for a course in introductory statistics. I really love it. Great UI -> simpler to teach. Students can actually use the program after they graduate (no prohibitive license costs). In-built upgrade path to R. What's not to like :-)

Best regards
Anders

Re: Save computed vars to jamovi, using Rj or similar

Posted: Sat Sep 17, 2022 9:22 am
by MAgojam
Hey Anders,

do you think you might be interested in taking a look at the screenshot of my recent reply in this post:
viewtopic.php?f=2&t=1084&start=10#p8650
Otherwise it comes back.

Cheers,
Maurizio

Re: Save computed vars to jamovi, using Rj or similar

Posted: Sat Sep 17, 2022 8:57 pm
by anbech
Sweet! Thanks Maurizio!
(what a coincidence, I had not seen the other post, but it seemed you just announced this feature a few days back)

Here is the most basic example, in case somebody needs it
[EDIT: I have cut it down to one line - I originally had an unnecessary line]

Code: Select all

data <- cbind(data, my_sum = data$a + data$b + 10)
(creates a new variable, my_sum, with the sum of variable a and b plus 10)

In order for a and b to be available for the calculation you must transfer them to the variables field, as shown in my screenshot.

Go look at Maurizio's post for examples of sorting and a little more complex calculations.
Screenshot 2022-09-19 165306.png
Screenshot 2022-09-19 165306.png (28.5 KiB) Viewed 1715 times

Re: Save computed vars to jamovi, using Rj or similar

Posted: Mon Sep 19, 2022 11:39 am
by MAgojam
anbech wrote:Here is the most basic example, in case somebody needs it
Thanks to you Anders,
leaving something of one's experience will surely be of use to those who will pass later even in silence.

Cheers,
Maurizio