How to calculate column mean & mean for sub-groups in R or RStudio

preview_player
Показать описание
This video shows you how to calculate mean for a category inside a given numeric variable. For example, calculating the mean age of women, calculating the mean age of individuals are men and were born in 2000, calculating the mean age of individuals who are women or who were born in 2000, etc.

How to calculate mean for a row or a selection of rows in R:

How to omit subjects with missing data, remove or ignore NA in calculations in R studio:

How to replace data values, including missing NAs data values in R or RStudio:

Please subscribe to my channel:
Рекомендации по теме
Комментарии
Автор

Iconic, thank you so much youre the only person/tutorial that actually makes sense!!

abbystarheart
Автор

That was an amazing explanation! Thank you so much I was looking everywhere for a tutorial like this.

makiemakie-uhqz
Автор

You have helped me so much I was struggling to find the mean of one category with respect to age I was pulling hair haha, thank you so much for offering your knowledge! :D

achan
Автор

WOW! Thank you so so much, greetings from Norway! 😊

nannaporshia
Автор

Thanks a million for your video content, it really helped me clear up a lot!!! I have a quick question. Lets say you want to calculate the mean age of "males" who tested "positive" (therefore, Gender and Status need to be considered), but you have NA values in the age column, how would I type this? Where exactly do I include the function "na.rm=TRUE"? Does this come at the end of the box brackets or at the end of the parentheses?

Kindest regards,
Heino

heinrichhechter
Автор

Thank you so much! I have a question: I have some NA values, so when I calculate the mean value of a column, I can give the following command to disregard those values:

mean(columnhere, na.rm = TRUE)

It's not working for the function to calculate a mean value based on a second factor -- I still get NA. What should I do?

caab
Автор

Your tutorial is very helpful! If using your example, how would I find the mean age of men whose aged 15 and older?

christinemarquez
Автор

Thanks for the video! Do you know how I can find out the lower quartile for one particular group in R please?

kerrilouise
Автор

Thanks for the tutorial. It is very helpful😊 So, for your same dataset, say I need to find the mean age for each sex in each respective year and finally return an output in a data frame. How would I go about that. Thanks🙂!

lucykev
Автор

Hello, I am from Paris also and have a question. I have a dataset with income for 100 individuals over 40 years and I want the mean & variance of income for each year and then find the one with smallest variance. How can i do that? Since in your tutorial we can one calculate for one specific case and not do it 40 times together.

utkarshdodrajka
Автор

Could you please tell me how can i find variance of a particular column. Column name can be ( price ) which includes price of the product so I had calculate variance of price

anubhavbansal
Автор

Good morning. How do you sum all attributes in a column of a large dataset of more than 100, 000 records? Also, assuming the dataset is made up of exports and imports for 5 different years, how do you sum all the monetary values of exports only and imports only for a particular year? I will be glad to get your response as soon as possible because I am currently working on an assignment to submit in less than a week. If you don't mind, kindly share your telephone contact so that I will contact you for more assistance.

zakariaosman
Автор

bruh just go straight to the for calculating mean?//come on bruh

jamesmettle