We can use data.table assignment (:=) to create a column in place without copying
library(data.table)
setDT(x)[, max.per.group := max(replicate), by = group]
x
# group replicate max.per.group
#1: A 1 5
#2: A 2 5
#3: A 3 5
#4: A 4 5
#5: A 5 5
#6: B 1 2
#7: B 2 2
#8: C 1 3
#9: C 2 3
#10: C 3 3
data
x <- data.frame(group,replicate)