I am trying to find all the classes that FormulaData and FormulaLookup have. I can find all of the formulas with FormulaData[] and the classes for a particular formula with FormulaData[#,"Classes"]. I have the following code which maps this function over all classes:
AssociationMap[FormulaData[#, "Classes"] &][FormulaData[]]
I've tried two methods to find all the classes but I have an issue with the level. Some of the classes are just a string like "Physics", but others are lists like {"Athletics", "Basketball"}. I am wondering how I can find both classes maybe with Flatten, Union, DeleteDuplcates, Join, or some other list operation.
I found a way to do it:
Union[Union[
DeleteMissing[
Map[TreeExpression][
Select[TreeDepth[#] == 1 &][
TreeLevel[
ExpressionTree[
Values[AssociationMap[FormulaData[#, "Classes"] &][
FormulaData[]]]], {-2, -1}]]]]] /. {{} -> Nothing},
DeleteMissing[
Union[Flatten[
TreeExpression[
RootTree[
ExpressionTree[
Values[AssociationMap[FormulaData[#, "Classes"] &][
FormulaData[]]]], 2]] /. {{} -> Nothing}]]]]