# reflect cols in a data.frame
X <- data.frame(x1 = 1:4, x2 = 5:8)
reflect(X)
reflect(X, 1)
reflect(X, 2)
cbind (X, letters[1:4]) |> reflect(1)
# reflect a candisc
iris.mod <- lm(cbind(Petal.Length, Sepal.Length, Petal.Width, Sepal.Width) ~ Species, data=iris)
iris.can <- candisc(iris.mod, data=iris)
coef(iris.can)
# reflect Can1
iris.can |> reflect(1) |> coef()
# reflect a cancor
data(Rohwer, package="heplots")
X <- as.matrix(Rohwer[,6:10]) # the PA tests
Y <- as.matrix(Rohwer[,3:5]) # the aptitude/ability variables
Rohwer.can <- cancor(X, Y, set.names=c("PA", "Ability"))
coef(Rohwer)
Rohwer.can |> reflect() |> coef()
Run the code above in your browser using DataLab