Yes, I thought that as well and had worked out this but didn't send it: add_Pscores<-function(x) { return(sum(unlist(x),na.rm=TRUE)) } by(rzdf[,c("PO1M", "PO1T", "PO2M", "PO2T")],rzdf$STUDENT_ID,FUN=add_Pscores) rzdf$STUDENT_ID: AA15285 [1] 724.8 ------------------------------------------------------------ rzdf$STUDENT_ID: AA15286 [1] 661.45
Jim On Fri, Oct 12, 2018 at 1:37 PM Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > > You said "add up"... so you did not mean to say that? Denes computed the > mean... > > On October 11, 2018 3:56:23 PM PDT, roslinazairimah zakaria > <roslina...@gmail.com> wrote: > >Hi Denes, > > > >It works perfectly as I want! ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.