Didn't realize it was that simple...thanks!!
Nick
jim holtman wrote:
try this:
x = rbind(c(0,1,1), c(2,3,1), c(4,5,1))
y = as.matrix(x)
rownames(y) = c("a","b","c")
colnames(y) = c("a","b","c")
ordered_list = c("b", "c", "a")
y
a b c
a 0 1 1
b 2 3 1
c 4 5 1
z <- y[ordered_list, ordered_li
try this:
> x = rbind(c(0,1,1), c(2,3,1), c(4,5,1))
> y = as.matrix(x)
> rownames(y) = c("a","b","c")
> colnames(y) = c("a","b","c")
> ordered_list = c("b", "c", "a")
> y
a b c
a 0 1 1
b 2 3 1
c 4 5 1
> z <- y[ordered_list, ordered_list]
> z
b c a
b 3 1 2
c 5 1 4
a 1 1 0
>
On Tue, Jan 27, 20
on 01/27/2009 02:26 PM Nick Matzke wrote:
> Hi all,
>
> This can't be very hard, but it is sticking me because I am a beginner.
> Setup:
>
> x = rbind(c(0,1,1), c(2,3,1), c(4,5,1))
> y = as.matrix(x)
> rownames(y) = c("a","b","c")
> colnames(y) = c("a","b","c")
> ordered_list = c("b", "c", "a")
Hi all,
This can't be very hard, but it is sticking me because I am a beginner.
Setup:
x = rbind(c(0,1,1), c(2,3,1), c(4,5,1))
y = as.matrix(x)
rownames(y) = c("a","b","c")
colnames(y) = c("a","b","c")
ordered_list = c("b", "c", "a")
How do I produce a new matrix, z, with the rows and column
4 matches
Mail list logo