Guilherme Castelao wrote:
> Hello all,
> 
> I'm moving to rpy2 but I still didn't get the new syntax. I have two
> simple questions:
> 
> 
> - I can create the nls with no trouble as below, but I can't figure
> out how to create the nls.control with rpy2?
> 
> model=robjects.r.nls(formula,data=dataf,start=start,control=control,trace=True)
> 

It hard to tell without knowing how you created the objects used in the 
function call.

> 
> - How would be a more elegant way to create a data frame then
> 
> d={"x":robjects.FloatVector([4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14]),"y":robjects.FloatVector([4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69])}
> dataf = robjects.r['data.frame'](**d)
> 

That way of creating a data.frame is correct, although not the only way.

# with rpy2-2.1.x-dev

import rpy2.robjects as robjects

dataf = robjects.DataFrame(d)


If having to know the type of the R vectors to create is seen as 
inelegant, on can put rpy_classic to use:

import rpy2.rpy_classic as rpy

d={"x":rpy.seq2veq([4.17,5.58,5.18,6.11,4.50,4.61,5.17]),
    "y":rpy.seq2veq([4.81,4.17,4.41,3.59,5.87,3.83,6.03])}


I have to remind myself to write more about creating data.frames in the 
documentation.

L.


> Thanks!
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to