Question: When coding in R, how do you get the summary statistic when the data is categorized? For example, I'm trying to get the mean of

When coding in R, how do you get the summary statistic when the data is categorized? For example, I'm trying to get the mean of race/ethnicity for a group of women in the placebo and in the treatment. For age I was able to use tapply(mat_age,treatment,summary) because it's age in years.

For race/ethnicitycit is: race_ethnicity Mother's self-reported race/ethnicity (B=black, H=Hispanic, W=white) and when I try the same, I get this.

tapply(race_ethnicity,treatment,summary)

$`0`

LengthClassMode

200 character character

$`1`

LengthClassMode

200 character character

I need to know the mean and sd for the race/ethnicity for women in the placebo group and women in the treatment group but I don't know the R coding to get there.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!