x <- iris[,1:4]
names(x) <- c(\"x1\",\"x2\",\"x3\",\"x4\")
aggregate(x1+x2+x3+x4~x1,FUN=sum,data=x)
Here is the output ,i wonder
1. What
The tilde operator creates a symbolic formula. Here's an excerpt from a blog post that explains it better than I could:
f = price ~ carat
[...]
We start by creating the formula f using the strange looking tilde operator. That tells the R interpreter that we're defining a symbolic formula, rather than an expression to be evaluated immediately. So, our definition of formula f says, "price is a function of carat".
The manual page on formulas has more to say about the tilde operator.