Okay this might not be the best place to post my question, but on the
rpy-list i'm getting no response and i'm really stuck with this problem.
Perhaps anyone on here has run into the same problem... I'm thinking my
newbieness to python probably is one of the reasons why i fail to see
what i'm doing wrong...

R is a statistical language and Rpy is the python interface for it. However
somehow I'm failing to see a step in the python code with which I
address the R language.

in R I can do :

a=diag(10)                              #produces an identity matrix of size
10
b=kmeans(a,2,5,10,"Forgy")    #calculate a kmeans clustering algorithm on
the 10 vectors contained by the matrix just declared.


in Ipython this does :

---------
In [1]: from rpy import *
RHOME= C:\Program Files\R\R-2.4.0
RVERSION= 2.4.0
RVER= 2040
RUSER= C:\Documents and Settings\Ronald
Loading the R DLL C:\Program Files\R\R-2.4.0\bin\R.dll .. Done.
Loading Rpy version 2040 .. Done.
Creating the R object 'r' ..  Done

In [2]: a = r.diag(10)

In [3]: b = r.kmeans(a,2,10,5,"Forgy")
---------------------------------------------------------------------------
rpy.RException                                Traceback (most recent call
last)

C:\Python24\<ipython console>

RException: Error in as.double.default(x) : (list) object cannot be coerced
to '
double'
---------

I've tried numerous things to get it to work, but i basically can not find
out how i do something as simple as the two statements in R in RPython.
Apparently something is going wrong somewhere in the conversion of python
objects to R objects but i can't seem to fix it. There is a code snippet in
the RPy-reference manual but it's only valid for python 2.2 and 2.1 and i
couldn't get it to work on 2.4.

If anyone has a clue on how to do this or can point me in the right
direction, i'd be much oblidged.

Kind Regards - Geofram
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to