I'm relatively new to Rstudio, and I'm even newer to this website, so I appreciate your patience. I'm trying to find a quicker way of getting the mean score of one variable for multiple demographics. For example:
Gender <- c("Male", "Female", "Other", "Male", "Female", "Other", "Female")
Age = c("21 or younger", "22-30", "31-40", "41-50", "21-30", "22-30", "31-40")
Country = c("Canada", "United States", "Canada", "UK", "United States", "UK", "Canada")
AnxietyScore = c(4, 3, 5, 7, 5, 3, 5)
data <- data.frame(Gender, Age, Country, AnxietyScore)
From this data frame, I would want the mean anxiety score for all genders, all age ranges, and all countries. I know I can do the following:
describeBy(data$AnxietyScore, group = data$Gender)
But this would only give me the mean anxiety score for each gender. What I'm looking for is something that provides the mean anxiety score, but for all demographics at once. Because I will need to provide this kind of score for a ton of variables and demographics, I'm trying to find a way to do this as quickly as possible. I appreciate your help.