You need to pass it as a vector and then you can convert to an array
structure in C.  Look at carray.c for one way to do this, there are others.
Browse the source code and see how different authors handle your problem.

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of johan Faux
Sent: Monday, March 20, 2006 1:13 PM
To: r-help
Subject: [R] How can I pass a R matrix as parameter to C code?


Hello, 
   
  Is it possible to pass R matrix as a parameter to an internal C procedure?
  From the documentation I got the impression that only 1-dim vectors can be
passed. 
  Why the following wont work for me?
   
   
  > a<-matrix(1:15,3,5)
> .C("pr",as.integer(a))
   
  void pr(int **a){
  a[1][1]=100;
}
   
   
  Thanks,
  Johan
   

                
---------------------------------


        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to