Hi Rpy2 users,

I'm having some difficulty passing the 'na.rm' parameter to the R 'max' 
function. I'm pretty new to rpy2, so I'm sure it's something obvious I'm 
missing.

I have referred to the documentation on this subject, here:

http://rpy.sourceforge.net/rpy2/doc-2.2/html/robjects_functions.html

I also tried searching the mailing list archive, but didn't come across an 
answer.


Here's my test source:

from rpy2 import robjects
from rpy2.robjects.packages import importr

data_series = robjects.IntVector( [1, 7, robjects.NA_Integer, 9, 2])

print data_series

# Note – I am using the underscore convention here, as
# suggested in the rpy2 documentation.
val = robjects.r.max(data_series, na_rm = True)

print val

Additionally, I tried the 'base' approach described in the docs, with the same 
problem:

from rpy2 import robjects
from rpy2.robjects.packages import importr
base = importr('base')

data_series = robjects.IntVector( [1, 7, robjects.NA_Integer, 9, 2])

print data_series

val = base.max(data_series, na_rm = True)

print val


I'm always getting 'NA' as the result, regardless of whether I set 'na_rm' to 
True or False (or 1 or zero, too).

The 'max' function does work as expected without the 'NA' object in the data 
series.

Here are my version numbers:

OS : Ubuntu 10.04 LTS, Intel x86_64
Python version : 2.7.4
R version: 2.15.3
Rpy2 version : 2.3.5

By the way, I am constrained to use Python 2.7.x, rather than Python 3.

What am I doing wrong here?

Thanks for your help,


Nick





------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to