Hello everyone,

I'm new to R and Rpy and in fact i'm still relatively new to Python. I keep
running into trouble and even though I searched the RPY-reference manual and
the R-reference manual i can't seem to find exactly why it is going wrong.
Also googling didn't provide any clues with regards to this error message,
so i thought i'd ask it here. Please excuse me for my ignorance if i'm doing
something really silly ;-).

---- insert code ----
from rpy import *

class Test:
   def as_r(self):
       return [[1,2,3,4,5],[2,3,4,5,1],[3,4,5,1,2],[4,5,1,2,3],[5,1,2,3,4]]

if __name__ == "__main__":
   a=Test()
   b=r.matrix(a)
   r.kmeans(b, 2, 5, 1, "Forgy")

---- end code ----


Basically what i'm trying to do is to run the r.kmeans on a small set of
vectors.
According to the R-reference manual the imput should consist of a numeric
matrix
of data. Which i think i've created in the above piece of code. When i run
the code i get
the following output :

---- output ----

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
Traceback (most recent call last):
 File "rpy-test.py", line 10, in ?
   r.kmeans(b, 2, 5, 1, "Forgy")
rpy.RException: Error in switch(nmeth, { : NA/NaN/Inf in foreign function
call (arg 1)

---- end output


Any clues would be highly appreciated.

Regards - Geofram
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to