I have this code:
m = sapply(split(DB, DB$ID), function(grp){
grp[max(grp$Time, na.rm =T), "Score"]-
grp[min(grp$Time, na.rm=T), "Score"]
})
Basically a code to calculate difference in score variables between rows (I have long data of repeated measures). I want to get the m as a value not as a list because I want to merge it back in the database how can I do this?