grouping a column of categorical variable into a set of unique values

一曲冷凌霜 提交于 2020-03-25 19:13:18

问题


Following this question, I want to know how I can specify a column/row of a specific sheet including a categorical variable, in Open/LibreOffice BASIC script/macro and get the unique list (i.e., set) of the values.

For example, consider the below dataset:

        A,   B,      C
1. gender, age, height
2.    man,  34,    180
3.  woman,  23,    155
4.    man,  54,    165
5.  other,  37,    172
6.  woman,  19,    169 

Now I want to specify the column tag A or header gender in Sheet1 and get the unique values stored in an array woman, man, other. It should be noted that

  • empty cells must be ignored
  • the length of the column is not known

I would appreciate if you could help me know how I can write a BASIC function which gets the column tag or header and the sheet name and returns the set of the categorical values as mentioned above. Thanks for your support in advance.

来源:https://stackoverflow.com/questions/60516128/grouping-a-column-of-categorical-variable-into-a-set-of-unique-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!