Transforming string variables

General help and assistance with jamovi. Bug reports can be made at our issues page: . (If you're unsure feel free to discuss it here)

by agoodquestion » Mon Nov 16, 2020 9:43 pm

I'm new to jamovi and liking it so far. I'm having trouble with the transform function, though. I'm working off a survey dataset that was (unfortunately) collected in Google Forms, so I have a couple of string variables generated from "check all that apply" questions that just list all the options selected by each respondent in one cell, separated by commas. I'm trying to create several Transform variable with a formula using the CONTAINS function in order to indicate whether the original variable contains a given string. The survey question had 10 check all that apply options + other. So I'm trying to create 10 Transform variables, one for each of the options that would indicate 1 if the original variable contains it, and 0 or blank if it doesn't. I've been trying to write this formula in the transform, but nothing works. I keep getting a "mis-specified" error message.

Please help!

Thank you so much in advance!!
Posts: 5
Joined: Mon Nov 16, 2020 9:30 pm

by jonathon » Mon Nov 16, 2020 10:03 pm

hi laura,

the mis-specified error is jamovi working correctly, and telling you that your formula isn't specified correctly. take a look at it, and see if you can figure out what's wrong with your formula.

if you can't, then feel free to post it here, and we'll take a look.

kind regards

User avatar
Posts: 1953
Joined: Fri Jan 27, 2017 10:04 am

by agoodquestion » Tue Nov 17, 2020 3:41 pm

hello jonathon,

thank you for your reply. i understand that jamovi is correctly identifying my formula as mis-specified, but i can't figure out what's wrong with the formula. here's what i've tried:

if $source CONTAINS 'Screening and diagnosis of hepatitis C' use 1

i know that typing CONTAINS in the pull-down box that's meant to have a mathematical operator is not right, so i tried using == instead, which got rid of the mis-specified error, but of course returned no results, since none of the cases in the source variable contain just that string - they contain more than that.

also, when i click on the transform button, a new variable does get created next to the original variable, but the entire column is red and there's an error message that says circular logic, even before i put in any formulas.

could you please help me figure this out!

many thanks,
Posts: 5
Joined: Mon Nov 16, 2020 9:30 pm

by MAgojam » Tue Nov 17, 2020 6:09 pm

Hi, lina.
Take a look at the attached screenshot, which shows a small example of using the CONTAINS () function.
As you can see, the search is case sensitive, reporting 1 when successful.
Screenshot_Trasform.PNG (68.35 KiB) Viewed 1096 times

User avatar
Posts: 215
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

by agoodquestion » Tue Nov 17, 2020 9:56 pm

thank you so much, maurizio!
this CONTAINS formula is exactly what i needed!
Posts: 5
Joined: Mon Nov 16, 2020 9:30 pm

Return to Help