"R. Michael Weylandt" <michael.weyla...@gmail.com> writes: > Without that though, I'm not sure you need the I(as.matrix.(dep)) and > I(as.matrix(ind)), I would imagine (untested) that eqn <- > data.frame(depy = dep, indx = ind) would work (probably better as I() > changes things just a little).
The I() must be there to prevent data.frame() from separating the coloumns of the matrices into individual variables in the data frame. Without I() there will be no variables depy and indx in the data frame. Try this: > A <- matrix(1:4, ncol=2) > B <- matrix(2:5, ncol=2) > A [,1] [,2] [1,] 1 3 [2,] 2 4 > B [,1] [,2] [1,] 2 4 [2,] 3 5 > ## With I(): > d1 <- data.frame(A = I(A), B = I(B)) > d1 A.1 A.2 B.1 B.2 1 1 3 2 4 2 2 4 3 5 > names(d1) [1] "A" "B" > d1$A [,1] [,2] [1,] 1 3 [2,] 2 4 > ## Without I(): > d2 <- data.frame(A = A, B = B) > d2 A.1 A.2 B.1 B.2 1 1 3 2 4 2 2 4 3 5 > names(d2) [1] "A.1" "A.2" "B.1" "B.2" > d2$A NULL > d2$A.1 [1] 1 2 -- Regards, Bjørn-Helge Mevik ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.