Dear group, kindly, I have the following data frame structure(c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1.5, 2, 1, 0, 2, 2, 1.5, 0, 0, 1, 1, 2, 0, 1, 2), .Dim = c(15L, 3L), .Dimnames = list( NULL, c("i", "Measure_id", "value")))
it has 3 coulmns I used df$newcoulmn <- ave(df$value, paste( df$i, df$Measure_id), FUN= function(x) x/max(x) ) to get x /max(x) and calc probability.. but I want to do that for each source measure_id" separately that means that rows 4,7,13 ..their value should be divided by 1.5 not 2.. rows 1,5,11 will be divided by 2 the max of their same group grouped by measure id how to make such grouping thanks in advance Ragia [[alternative HTML version deleted]] ______________________________________________ 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.