/usr/lib/python2.7/dist-packages/rpy2/robjects/language.py is in python-rpy2 2.4.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | """
Utilities for manipulating or evaluating the R language
"""
import rpy2.robjects.conversion as conversion
import rpy2.rinterface as ri
_reval = ri.baseenv['eval']
_parse = ri.parse
def eval(x, envir = ri.globalenv):
""" Evaluate R code. If the input object is an R expression it
evaluates it directly, if it is a string it parses it before
evaluating it.
By default the evaluation is performed in R's global environment
but a specific environment can be specified."""
if isinstance(x, str) or isinstance(x, unicode):
p = _parse(x)
else:
p = x
res = _reval(p, envir = envir)
res = conversion.ri2ro(res)
return res
del(ri)
|