Save computed vars to jamovi, using Rj or similar

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
anbech
Posts: 2
Joined: Fri Sep 16, 2022 10:25 pm

Save computed vars to jamovi, using Rj or similar

Post 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
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

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

Post 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
anbech
Posts: 2
Joined: Fri Sep 16, 2022 10:25 pm

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

Post 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 1621 times
Last edited by anbech on Mon Sep 19, 2022 2:55 pm, edited 1 time in total.
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

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

Post 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
Post Reply