filter nominal variables

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
David
Posts: 30
Joined: Wed Jun 13, 2018 10:18 am

filter nominal variables

Post by David »

Hi, I have a variable with 16 different nominal text values (levels) and N=400, and I'm trying to filter out all but four levels. I've tried FILTER(var, var == 'level1' or var == 'level2' or var == 'level3' or var == 'level4') as per the recent blog post by Jonathon but it isn't working as expected. Any ideas?

David
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: filter nominal variables

Post by jonathon »

hi,

can you attach an .omv file?

with thanks
David
Posts: 30
Joined: Wed Jun 13, 2018 10:18 am

Re: filter nominal variables

Post by David »

Sure, attached.
thanks.
david
Attachments
aflsmall_finalists.omv
(2.83 KiB) Downloaded 425 times
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: filter nominal variables

Post by jonathon »

hi,

so there's two ways you can filters. either using the filters, or the computed variables. for the filters you can just use:

afl.finalists == 'Melbourne' or afl.finalists == 'Sydney' or afl.finalists == 'Adelaide' or afl.finalists == 'Brisbane'

but if you want to 'compute' a new column containing only these values, you'd use your formula:

FILTER(afl.finalists,afl.finalists == 'Melbourne' or afl.finalists == 'Sydney' or afl.finalists == 'Adelaide' or afl.finalists == 'Brisbane')

makes sense?

jonathon
David
Posts: 30
Joined: Wed Jun 13, 2018 10:18 am

Re: filter nominal variables

Post by David »

That works. Thanks for the quick response.
Post Reply