I get the following from S-Plus 6.1 under Windows 2000:
> (d2x2 <- matrix(1:4, 2, dimnames = list(c("9", "8"), c("3", "4"))))
3 4
9 1 3
8 2 4
> d2x2[, "3"]
9 8
1 2
> d2x2["9", , drop = F]
3 4
9 1 3
hope this helps. spencer graves
Leeds, Mark wrote:
I think this question is pretty basic but i have been stuck for a while.
i have a matrix whose columns are strings such as "8344", "8312" etc.
later on, in a program, i have a variable called ticker1 which is a string
such as the above. so , i want to access the column corresponding
to whatever string ticker1 is.
i tried matrix[,ticker1] : this gives me back weird stuff which i kind
of expected.
i tried matrix[,get(ticker1)] : this gives me back "object "8344" not found.
does anyone know how to do this ? i'm gonna play
around some more but thanks in advance.
mark
|