Counting means for factors

Is it, with some trick, possible to count means and other values for variables that are categorical?

Can you give an example of a case where this would make sense? In general, categorical variables do not have a numeric value (that is why they are categorical) and even if you label them with numbers, as is done in a factor, there is no meaning to the distance between the values. For example, if my factor levels are apple, banana, cherry, I can assign those the numbers 1, 2 and 3 but cheery is not worth three times as much as apple.

This question is based on an assumption that for plotting it is beneficial if variables are factors. I don't see the benefits in this, but this is what I have been told. Should I disregard this assumption in the first place? Does it make any sense?

Assuming that plotting is easier with factors, and that it's not possible to do calculations with factors, it would mean that before plotting you have to count all the values, and then transform them into factors and then plot with them.

For plotting it is better for variables to be factors rather than characters to allow for different ordering. It seems like you have misinterpreted this for numerical variables.

Makes sense. Thank you martin.R

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.