Dear Friends:
I have cracking away at this problem for the better part of two days.
I have a list of numerical data (each category is a row, observations
are in columns) that I am trying to feed into rpy to convert into an r
matrix for further calculation. No matter how I have tried it winds up
not respecting the structure and takes the data as one column with rows
being the total number of observation.
import rpy2.robjects as robjects
r = robjects.r
mydata # 3 x 221 list -- could use numpy -- anything
asmatrix = r('as.matrix') # r.as.matrix throws an exception
holder_for_r_compute = asmatrix(mydata, nrow = 221, ncol = 3)
# yields #
structure(list(list( ... # actual values # ... ) ) .Dim = c(3L,1L))
###
when I try to use this matrix for calculations I get exceptions:
r.cov(holder_for_r_compute)
# yields #
----------------------------------------
.../python2.5/site-packages/rpy2/robjects/__init__.py in __call__(self,
*args, **kwargs)
372 for k, v in kwargs.iteritems():
373 new_kwargs[k] = py2ri(v)
--> 374 res = super(RFunction, self).__call__(*new_args,
**new_kwargs)
375 res = ri2py(res)
376 return res
<class 'rinterface.RRuntimeError'>: Error: is.atomic(x) is not TRUE
----------------------------------------
I know it is not converting correctly...reading data from r side is not
possible as it is calculated from python code. Has anyone approached
something similar. Thanks in advance.
- Gabe.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list