erroe about create matrix in r.net

Jul 19, 2012 at 5:58 AM

in r,if I want create a matrix,I use the statement like this.

> NAMES<-c("a","b","c","d","e")
> matrix(1:25,ncol=5,nrow=5,dimnames=list(NAMES,NAMES))
  a  b  c  d  e
a 1  6 11 16 21
b 2  7 12 17 22
c 3  8 13 18 23
d 4  9 14 19 24
e 5 10 15 20 25

In R.NET,I Do the same thing,

string[] names = new string[] { "a", "b", "c"};
                CharacterVector namesVector = engine.CreateCharacterVector(names);
                engine.SetSymbol("NAMES", namesVector);
                var matrix = engine.Evaluate("matrix(1:9,ncol=3,nrow=3,dimnames=list(NAMES,NAMES))").AsNumericMatrix();

the matrix create success,but it lost colnames and rownames.

If want access colnames and rownames,it must be do like this:

 private static string RF_USER_MATRIX = @"user.matrix<-function(x)
                                                 {
                                                    k = matrix(1:9,nrow=3,ncol=3,dimnames=list(x,
                                                    x));
                                                    k[1,1]=1;
                                                 k
                                                 }".Replace(" ","");

then the colnames and rownames are incloude.

is it the r.net problem?