Mean of one column with respect to another

0 votes
Hi!!

I am new to R and I want to know how to find out the mean of one column with respect to other.

Can someone explain in simple terms?
Jul 25, 2018 in Data Analytics by Sahiti
• 6,370 points
1,900 views

1 answer to this question.

0 votes

Consider the inbuilt iris dataset in R.

Use the mean() function from the mosaic package.

mean(iris$Sepal.Length~iris$Species)

This command gives the mean values of Sepal-Length across different species of the iris flower.

And, when you run this command, you will see in the output that “virginica” has the highest sepal length and “setosa” has the lowest sepal length. 

answered Jul 25, 2018 by CodingByHeart77
• 3,750 points

Related Questions In Data Analytics

0 votes
1 answer

How to check row value of one column wrt another column?

Hi ratna, For suppose DF is the DataFrame ...READ MORE

answered Jul 26, 2019 in Data Analytics by anonymous
879 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,943 views
0 votes
1 answer

With the help of tidyverse: how to rename a column to a variable name

With the help of Dplyr: rename function ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Apr 3, 2018 by DeepCoder786 951 views
0 votes
0 answers
0 votes
1 answer

How to calculate group mean and assign it to new data in R

You can use something like this: df$grp.mean.values <- ...READ MORE

answered Jun 27, 2018 in Data Analytics by Sahiti
• 6,370 points
1,886 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,037 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,188 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,894 views
0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
4,563 views
0 votes
1 answer

How to replace NA values in a dataframe with Zero's ?

It is simple and easy: df1<-as.data.frame(matrix(sample(c(NA, 1:10), 100, ...READ MORE

answered Apr 10, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
2,068 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP