runapp-aus / strayr

A catalogue of ready-to-use ABS coding structures. Package documentation can be found here: https://runapp-aus.github.io/strayr/
45 stars 14 forks source link

Add function to return the level of a classification? #69

Open daviddiviny opened 2 years ago

daviddiviny commented 2 years ago

I was thinking that for example, this function would return the highest level (or all levels) for which a classification of an occupation exists.

For example: find_anzsco_level("Chief Executives, General Managers and Legislators") would return Sub-Major Group

MattCowgill commented 2 years ago

I love this idea. Should work so long as there's no duplicates, right?

daviddiviny commented 2 years ago

What do you mean duplicates? Some classifications exist at multiple levels, e.g. Chief Executives, General Managers and Legislators but I think it should return the highest level by default, with an option to return all levels?

Probably easily done in parallel with #50 so you can just filter?

MattCowgill commented 2 years ago

Yep that's what I meant, classifications that exist at multiple levels. Returning the highest level by default makes sense... maybe with a message to inform the user that there are multiple matching levels?

daviddiviny commented 2 years ago

I think the underlying data would look like this. What do you think the function should return?

code occupation level
1 Managers Major Group
2 Professionals Major Group
3 Technicians And Trades Workers Major Group
4 Community And Personal Service Workers Major Group
5 Clerical And Administrative Workers Major Group
6 Sales Workers Major Group
mrjoh3 commented 2 years ago

Perhaps a character vector ordered finest level to broadest. That way you would always know what the position in the vector means.

daviddiviny commented 2 years ago

There is an issue where the ANZSCO6 is singular, but other levels are plural...