Hello,

I have a question about using a dataframe in the R function (lme)
This is the r function I am trying to run
r.lme("gpr ~ 1, random =~1 | groups, weights")

This is the summary of the code.

import rpy2
import rpy2.robjects as robjects
r = robjects.r
r.library('nlme')

d = {'id': robjects.IntVector(district_list), 'gpr':
robjects.FloatVector(district_gpr), 'weight':
robjects.FloatVector(district_weight)}
dataf = robjects.DataFrame(d)
model = "gpr ~ 1, random = ~1 | id, weight"
rs = r.lme(model, dataf)

This is my error:
Traceback (most recent call last):
  File "<pyshell#105>", line 1, in <module>
    rs = r.lme(model, dataf)
  File "C:\Python27\lib\site-packages\rpy2\robjects\functions.py", line 86,
in __call__
    return super(SignatureTranslatedFunction, self).__call__(*args,
**kwargs)
  File "C:\Python27\lib\site-packages\rpy2\robjects\functions.py", line 35,
in __call__
    res = super(Function, self).__call__(*new_args, **new_kwargs)
RRuntimeError: Error in UseMethod("lme") :
  no applicable method for 'lme' applied to an object of class "character"

I have tried attaching the dataframe and I still get the same error
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to