Using a variable IF another variable meets criteria

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
amajoy
Posts: 2
Joined: Tue Jun 07, 2022 2:24 am

Using a variable IF another variable meets criteria

Post by amajoy »

Hello - I'm stumped on this one.

I have two versions of a test, Test A and Test B.
I have two conditions, Control and Experimental
Participants receive a pre-test, and a post-test.
Participants can receive A first / as the pre-test, or B first/ as the pre-test, randomly assigned when condition is assigned.
I need to create a "Pretest Score" for ALL participants, and if they were in Control A or Experimental A, that pretest will be Test A. If they were in Control B or Experimental B, that pretest will be Test B.

The data are already in my data frame as Test A or Test B, but not if that was pre-test or post-test. I can post-process the CSV output in Excel to do a few conditional statements, but then I have to hand-update that code with every export of my results. I"d rather do it in Jamovi so I can set up the analyses and append results as they come. .

Is there a neat way to do this?
amajoy
Posts: 2
Joined: Tue Jun 07, 2022 2:24 am

Re: Using a variable IF another variable meets criteria

Post by amajoy »

So, what I keep trying to do is like this: FILTER(`Test 1 Score`, Condition == 'Control12' or Condition == 'Experimental12 ') AND ('`Test 2 Score`, Condition == 'Control21' or Condition == 'Experimental21") , but it seems like you can't do complicated strings in Jamovi?
User avatar
jonathon
Posts: 2622
Joined: Fri Jan 27, 2017 10:04 am

Re: Using a variable IF another variable meets criteria

Post by jonathon »

there's lots of ways to do this. do you simply want

IF(Condition == 'Control12' or Condition == 'Experiment12', TestA, TestB)

there's no problem combining things with ors and ands if you need something more complex.
Post Reply