|
From: Kylee K. <kiy...@gm...> - 2009-04-24 19:48:18
|
Hi,
I am trying to save plot outputs in pdf file format using RPy2.
The usual simple routine that I would do in R is something like this:
x <- rnorm(100)
pdf("/home/me/public_html/test.pdf")
hist(x)
dev.off()
Now, using Rpy2, I am trying the same job, but I am getting error message
for r.dev.off().
Here are python commands.
>>> import rpy2.robjects as robjects
>>> r = robjects.r
>>> x = r.rnorm(100)
>>> mypdf = r.pdf("/home/me/public_html/test.pdf')
>>> mypdf = r.hist(x)
>>> mypdf = r.dev.off()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/releng/tools/python/2.4.1/lib/python2.4/site-packages/rpy2/robjects/__init__.py",
line 511, in __getattribute__
raise orig_ae
AttributeError: 'R' object has no attribute 'dev'
Is there anybody knows how to properly use R pdf() and dev.off() using RPy?
Thank you in advance.
Ki
|