I’m going to use SparseMatrices. For these SparseMatrices I’m using the R 
module SparseM.

There are some problems by converting SparseMatrices. Maby there is an easy 
solution. But at the moment I can’t found it. Before starting I read the RPY 
Reference Manual. The Manual is not complete enough to answer my questions.

Code:
-----------------------------------------------------------------------------------
from rpy import *
r.library('SparseM')

set_default_mode(NO_CONVERSION)

r.m = r.matrix(range(1,26), 5, 5)
r.print_(r.m)
-----------------------------------------------------------------------------------

How is it possible to declarate/subscript a value to the matrix without 
conversion?
e.g.: r.m[1,1] = 100, r(r.m[1,1] <- 100, r.m[1][1] = 100)
Not working in RPY, get errors like:

IndexError: R object index out of range
TypeError: sequence index must be integer

After generating this matrix I convert the matrix to a SparseMatrix

-----------------------------------------------------------------------------------
r.M_csr = r.as_matrix_csr(r.m)
r.print_(r.M_csr)
-----------------------------------------------------------------------------------

I use the slots to get the information:
Why I can’t use[1,2] like below.
In R-console [1,2] works fine. Did I need a Conversion?
I don’t think so its a Robj object……
-----------------------------------------------------------------------------------
ra = r.slot(r.M_csr, 'ra')
ra2 = r.slot(r.M_csr[1,2], 'ra')
-----------------------------------------------------------------------------------


Thanks for your time!

_________________________________________________________________
Eindeloos zoeken naar dat ene document is nu voorbij! Klik hier 
http://toolbar.live.com


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to