Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36641
| From | Piet van Oostrum <piet@vanoostrum.org> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How to call ltm function using rpy package in python |
| Date | 2013-01-11 20:47 +0100 |
| Message-ID | <m238y75wp1.fsf@cochabamba.vanoostrum.org> (permalink) |
| References | <431b8876-6964-4666-a545-046b42b27667@googlegroups.com> |
Mohit Khanna <mohit.personal1987@gmail.com> writes:
> I am trying the following code--
>
> from rpy import *
> r.library("ltm")
>
> dat= #some data frame or matrix
> r.ltm(r('dat~z1'))
>
> error coming is---
> RPy_RException: Error in eval(expr, envir, enclos) : object 'dat' not found
>
> Please tell me the right way to call ltm function using rpy library
Your problem is that the 'dat' object is in the Python world but not in
the R world. However, the expression r('dat~z1') is looking for a 'dat'
object in the R world. So you must copy the Python object to the R
world.
I don't know if this will work in rpy, but it does work in rpy2. Rpy2
has much better possibilities than rpy. But just try it:
r['=']('dat', dat)
r.ltm(r('dat~z1'))
--
Piet van Oostrum <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
How to call ltm function using rpy package in python Mohit Khanna <mohit.personal1987@gmail.com> - 2013-01-08 02:29 -0800 Re: How to call ltm function using rpy package in python Piet van Oostrum <piet@vanoostrum.org> - 2013-01-11 20:47 +0100
csiph-web