Mean of categorical variables from plyr package

0 votes
My categorical variable, risk, is divided into three groups: ADV, HHM, and POV.

I'm looking for the average of these three groups for four continuous variables: read.5, read.6, read.7, and read.8, which are reading scores from grades 5 to 8.

It's the,2:5 of my dataset and an old textbook example. I used the following code, which appears to be incorrect despite the fact that it is correct according to the textbook example:

ddply(.data = MPLS[,2:5],.variables =.(MPLS$risk), myrisk

na.rm = TRUE,.fun = mean)

Earlier today, I received an error message for a section of code that read:

mean(MPLS[,2:5], na.rm = TRUE) - mymeans

When I googled it, I discovered that the R software had changed, and I needed to find another to operate with.
Jun 17 in Data Analytics by Avinash
• 1,060 points
4 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Analytics

0 votes
0 answers

https://www.edureka.co/community/183864/mean-of-categorical-variables-from-plyr-package

I'm modelling with the fpp2 package's data ...READ MORE

Jun 17 in Data Analytics by Avinash
• 1,060 points
6 views
0 votes
1 answer

How to create dummy variables based on a categorical variable of lists in R?

You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE

answered Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,720 points
1,637 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
953 views
+1 vote
2 answers

Finding number of missing values and removing those missing values from a data-frame

To find number of missing values for ...READ MORE

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

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,554 views
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,240 points
2,578 views
0 votes
1 answer

R: Sample from a neighborhood according to scores

I would suggest you to use the truncated ...READ MORE

answered May 29, 2018 in Data Analytics by Sahiti
• 6,360 points
172 views
0 votes
1 answer

How to sample random rows in dataframe?

Create data frame and then implement as ...READ MORE

answered Jul 3, 2018 in Data Analytics by Sahiti
• 6,360 points
379 views
0 votes
1 answer

How to sample n random rows per group in a dataframe?

You can assign a random ID to ...READ MORE

answered Jul 3, 2018 in Data Analytics by Sahiti
• 6,360 points
3,727 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP