[R] Matrix variable in C code
Gabor Csardi
csardi at rmki.kfki.hu
Thu Feb 2 18:47:06 CET 2006
On Thu, Feb 02, 2006 at 06:27:47PM +0100, depire at inrets.fr wrote:
[...]
The problem is that as.double drops the dim attribute:
> b <- matrix( 1:4, 2, 2)
> b
[,1] [,2]
[1,] 1 3
[2,] 2 4
> as.double(b)
[1] 1 2 3 4
>
You can try:
> b <- matrix( 1:4, 2, 2)
> d <- dim(b)
> b <- as.double(b)
> b
[1] 1 2 3 4
> dim(b) <- d
> b
[,1] [,2]
[1,] 1 3
[2,] 2 4
Another thing is that i cannot really see why the ZT parameter of the .Call
should be a matrix anyway. It's just the vector (40 21 30 20). Or am i
missing something?
Also, this is an unrelated issue but your VPCEfron C function takes five
parameters and the R code provides six....
Gabor
> =====================================
>
> You can save these two simple programs in order to test my code.
>
> Thanks.
>
[...]
--
Csardi Gabor <csardi at rmki.kfki.hu> MTA RMKI, ELTE TTK
More information about the R-help
mailing list