[R] Questions on formula in princomp

Sasha Pustota popgen at gmail.com
Thu Apr 13 20:26:15 CEST 2006


I hope this time I'm using the "iris" dataset correctly:

ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
lir <- data.frame(log(ir))
names(lir) <- c("a","b","c","d")

I'm trying to understand the meaning of expressions like "~ a+b+c+d",
used with princomp, e.g.

princomp(~ a+b+c+d, data=lir, cor=T)

By inspection, it looks like the result is the same as in

princomp(lir, cor = T).

Do "a+b+c+d" simply specify the columns to be included? Could someone
provide a meaningful example of princomp formula that uses operators
other than "+"?

In linear model, E(y)= xb, examples, "~" is usually placed between "y"
and "x". What is the meaning of "~" here?




More information about the R-help mailing list