On Wed, 2008-10-08 at 16:49 -0500, Srikanth wrote:
[...]
> -----------------------------------------------------------------
> However, when I run the equivalent code via RPy in a Python console,
> -----------------------------------------------------------------
> import rpy2.robjects as robjects
> r = robjects.r
> m = r.matrix(r.rnorm(100), ncol=5)
> pca = r.princomp(m)
> r.plot(pca, main="Eigen values")
> r.biplot(pca, main="biplot")
> r.dev.off()
> -----------------------------------------------------------------
> I get the following error message
> -----------------------------------------------------------------
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/usr/local/lib/python2.6/site-packages/rpy2/robjects/__init__.py",
> line 450, in __getattribute__
>     return self[attr]
>   File
> "/usr/local/lib/python2.6/site-packages/rpy2/robjects/__init__.py",
> line 453, in __getitem__
>     res = rinterface.globalEnv.get(item)
> LookupError: 'dev' not found
> -----------------------------------------------------------------
> 
> I am not sure how to solve the above problem, or if it is a bug.

Python is not R. The dot ("."), like in a large number of other
language, has a particular semantic meaning and therefore is not a valid
character for variable names.

r['dev.off']() is what you are looking for.



>  Any pointers/help is appreciated in advance.
> Thanks.
> Srikanth.
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ rpy-list mailing list 
> rpy-list@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/rpy-list


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to