Computing new variables — recycling code

Discuss the jamovi platform, possible improvements, etc.
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Computing new variables — recycling code

Post by jonathon »

If I use STATA or SPSS or R, I can send other researchers my raw data, plus syntax file and they can reconstruct every single step or change them.
this is also true of jamovi. you can return to any analysis you've created, any transform you've applied, or any computed variable you've made, and see exactly what was done. it's part of our design philosophy that nothing is lost, and everything can be returned to.
I think if it were possible to insert an R code chunk wherein one could write variables back to the dataset, and have that R code appear in the output pane for clarity, then it would go a long way to addressing this issue.
i think we're getting pretty close to being able to provide this feature. i'll try and have something to you in the next month.

jonathon
User avatar
leehw
Posts: 20
Joined: Fri Nov 22, 2019 8:48 am

Re: Computing new variables — recycling code

Post by leehw »

That would be very exciting! Thanks for working on this.
RaphaelHuber
Posts: 6
Joined: Mon Nov 30, 2020 2:16 pm

Re: Computing new variables — recycling code

Post by RaphaelHuber »

This sounds awesome! Thank you for your efforts with Jamovi.

Yes you are right non-linear traceability really is already implemented in Jamovi, and I also must say, that the way you did it is truly awesome! Jamovi influences the way I start to dig into data because of its workflow in a very creative and playful manor. Your concept is so well thought out, that it really gets inconceivable how other statistics programs have not always done it the way you do it. It's so intuitive. You may not be apple people, but it feels to me kind of like the iPhone felt to me compared to phones before that.

So, in a way I can see, that spewing out linear code is sort of a step backwards for Jamovi. Yet the linear way is easier to reconstruct, so I'm really happy you work on this.
User avatar
reason180
Posts: 274
Joined: Mon Jul 24, 2017 4:56 pm

Re: Computing new variables — recycling code

Post by reason180 »

Here's a two-step approach one might take:

Use R rather than jamovi to code and run all data transformations prior to running any actual analyses. Output the resulting data file, then load it into jamovi.

I'm thinking of doing this in a graduate class, in which I'll incorporate both R and jamovi. This would give students some knowledge of, and exposure to, using actual R code for computation, thus helping them learn R at a level more detailed than what they'd get from just looking at jamovi's R/jmv syntax.
User avatar
leehw
Posts: 20
Joined: Fri Nov 22, 2019 8:48 am

Re: Computing new variables — recycling code

Post by leehw »

I realise this is an old thread, but I just wondered if there might be any update on this. I just tried some basic code writing to the data and within the R code snippet itself, the one gets the expected results.

I tried to write to

Code: Select all

data
from within an R snippet.

Code: Select all

data[1,1] <- "test"

data[1,1]
It prints back the test value. But that value doesn't show up in the Jamovi data spreadsheet for later use.

I'm sorry to harp on about this but it really is one of the few things stopping me from using Jamovi for research. I already use it for teaching and my students love it.
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Computing new variables — recycling code

Post by jonathon »

my plan is to provide the ability to write data from rj to the spreadsheet by june.

jonathon
User avatar
reason180
Posts: 274
Joined: Mon Jul 24, 2017 4:56 pm

Re: Computing new variables — recycling code

Post by reason180 »

RE: "my plan is to provide the ability to write data from rj to the spreadsheet by June."

Just wondering if this is still something that's in the works, or has it already been implemented?
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

Re: Computing new variables — recycling code

Post by MAgojam »

reason180 wrote:Just wondering if this is still something that's in the works, or has it already been implemented?
Yes there is.
viewtopic.php?f=2&t=2275#p8460

The link takes you to the post where I gave a little hint to use this possibility from Rj+ and get a new variable in the sheet.
As you will see from the screenshot, a new variable is created with the missing totals of each row of the sheet with the selected variables.

Cheers,
Maurizio
User avatar
leehw
Posts: 20
Joined: Fri Nov 22, 2019 8:48 am

Re: Computing new variables — recycling code

Post by leehw »

This is great news! So is this still in development or does the latest build have this capacity with the Rj editor? ... or indeed is Rj+ something different? I can't see Rj+ in the modules list.
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

Re: Computing new variables — recycling code

Post by MAgojam »

Hey @leehw,

with jamovi v2.3.13 of 21 JUNE 2022, there was also an important improvement of the Rj module.
In the jamovi library you will find the Rj module v2.0.6 with the possibility of using the Rj or Rj+ editor, as you can see from the screenshot.
Rj.png
Rj.png (151.58 KiB) Viewed 2045 times
Cheers,
Maurizio
Post Reply