Page 1 of 1

filter nominal variables

Posted: Wed Jun 13, 2018 10:29 am
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

Re: filter nominal variables

Posted: Wed Jun 13, 2018 10:42 am
by jonathon
hi,

can you attach an .omv file?

with thanks

Re: filter nominal variables

Posted: Wed Jun 13, 2018 1:09 pm
by David
Sure, attached.
thanks.
david

Re: filter nominal variables

Posted: Wed Jun 13, 2018 11:18 pm
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

Re: filter nominal variables

Posted: Thu Jun 14, 2018 5:27 am
by David
That works. Thanks for the quick response.