with() function applies an expression to a dataset.
#with(data,expression)
By() function applies a function t each level of a factors.
#by(data,factorlist,function)