## simple example showing what it does
meanDeviations(1:10)
## example use case, applied to a data.table
library(data.table)
d <- as.data.table(iris)
d[, c("BSepal.Length", "WSepal.Length") := meanDeviations(Sepal.Length),
by = Species]
str(d)
rm(d)
Run the code above in your browser using DataLab