How to get an “average” for a categorical variable?
I have a large dataset that has 12 quadrats per survey with a slew of data. Most is numeric, but I have one categorical variable (Grazing – Either “Present” or “Absent”), that I wish to utilize. I’ve created a single row of data per survey by averaging the numeric variables in the 12 quadrats to have one average value for each survey rather than 12, however I’m not sure how to have that carry over with my categorical variable.
Summing rows with the same value across multiple distinct columns [duplicate]
This question already has answers here: Aggregate / summarize multiple variables per group (e.g. sum, mean) (10 answers) Closed last month. I have a data table structured like this: Molecular Formula AHBG13 AHBG15 AHBG16 AHBG19 AHBG20 C23H48NO7P 1767 4570 7052 8831 7921 C24H50NO7P 0 0 0 73331 0 C24H50NO7P 45335 48281 0 0 77333 C24H50NO7P […]