The basic problem is that by default, RPy converts objects returned to python to a python object. Unfortunately, this conversion loses some information, including the type of the original R object.
To avoid this conversion add two lines to your code: On Feb 22, 2008, at 12:36PM , marco hofmann wrote: > Hi all, > I have a problem with the predict command. Here is an example: > > from rpy import * # avoid automatic conversion set_default_mode(NO_CONVERSION) > r.library("nnet") > model = r("Fxy~x+y") > > df = r.data_frame(x = r.c(0,2,5,10,15) > ,y = r.c(0,2,5,8,10) > ,Fxy = r.c(0,2,5,8,10)) > > NNModel = r.nnet(model, data = df > , size =10, decay =1e-3 > , lineout=True, skip=True > , maxit=1000, Hess =True) > > XG = r.expand_grid(x = r.seq(0,7,1), y = r.seq(0,7,1)) > x = r.seq(0,7,1) > y = r.seq(0,7,1) > > fit = r.predict(NNModel,XG) # turn automatic conversion back on set_default_mode(BASIC_CONVERSION) fit = r.predict(NNModel,XG) print fit -Greg ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list