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
filter nominal variables
Re: filter nominal variables
hi,
can you attach an .omv file?
with thanks
can you attach an .omv file?
with thanks
Re: filter nominal variables
Sure, attached.
thanks.
david
thanks.
david
- Attachments
-
- aflsmall_finalists.omv
- (2.83 KiB) Downloaded 425 times
Re: filter nominal variables
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
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
That works. Thanks for the quick response.