I am trying to compute GPA from class grades(which have been normallized) I have for example the following matrix
Master = SID B2A B2B B2C C2A C2B C2C C118A C118B C118C 001 0.01 0.5 -0.4 1.2 -1.8 0.3 -0.3 0.4 0.5 002 0.01 0.5 -0.4 0.5 -0.4 1.2 -1.8 0.3 -0.3 003 0.04 0.05 0.5 -0.4 - 0.5 0.4 -1.2 1.8 0.3 etc Where each column has a zero mean and a standard deviation of 1. I want to calculate a weighted average for each row(student ID) that takes into account that B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B, B2C, C2A,C2B,C2C are 5 unit classes I have tried Units<-c(4,5,5,5,5,5,4,4,4) Master$zGPA <-weighted.means(Master[,2:10],Units) But that gets me one number and not a vector. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.