If I index a data frame with a row name that doesn't exist, I seem to
get the closest value. But this doesn't seem right. Ideas?
ar = data.frame(c1 = c("test1", "test1", "test1"), c2 = c(1, 1, 1), c3
= c(1, 3, 20))
row.names(ar) = do.call("paste", c(ar[,c(1,3)], sep = ":"))
> ar
c1 c2 c3
test1:1 test1 1 1
test1:3 test1 1 3
test1:20 test1 1 20
> ar["test1:2",]
c1 c2 c3
test1:20 test1 1 20
I appreciate any thoughts.
This also works with list elements, for example
reg1 <- lm(Y ~ X, data=df1)
reg1$coef
The second command will print the element of the list named "coefficients".
-Bill.
--
William T. Hoyt, Ph.D.
Training Director, Ph.D. Program
Department of Counseling Psychology
University of Wisconsin
335 Education Building, 1000 Bascom Mall
Madison, WI 53706