In [11]:
import numpy as np
from astropy.io import fits
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
from pylab import *
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
In [14]:
stats = importr('stats')
base = importr('base')
datasets = importr('datasets')
In [15]:
%run ~/Dropbox/pythonCode/LCSanalyzeblue.py
WARNING: problem matching to moustakas MSTAR_50 - probably ok
WARNING: problem matching to moustakas MSTAR_50 - probably ok
did not find 99840
did not find 146607
In [28]:
fiteqn='SIZE_RATIO ~ SIGMA_5'
t=stats.lm(fiteqn,data=base.data_frame(SIZE_RATIO=s.s.SIZE_RATIO[s.sampleflag],SIGMA_5=s.s.B_T_r[s.sampleflag]))
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-28-a0052b6d23c3> in <module>()
1 fiteqn='SIZE_RATIO ~ SIGMA_5'
----> 2 t=stats.lm(fiteqn,data=base.data_frame(SIZE_RATIO=s.s.SIZE_RATIO[s.sampleflag],SIGMA_5=s.s.B_T_r[s.sampleflag]))
/Users/rfinn/Ureka/variants/common/lib/python2.7/site-packages/rpy2/robjects/functions.pyc in __call__(self, *args, **kwargs)
168 v = kwargs.pop(k)
169 kwargs[r_k] = v
--> 170 return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
171
172 pattern_link = re.compile(r'\\link\{(.+?)\}')
/Users/rfinn/Ureka/variants/common/lib/python2.7/site-packages/rpy2/robjects/functions.pyc in __call__(self, *args, **kwargs)
97 new_kwargs = {}
98 for k, v in kwargs.items():
---> 99 new_kwargs[k] = conversion.py2ri(v)
100 res = super(Function, self).__call__(*new_args, **new_kwargs)
101 res = conversion.ri2ro(res)
/Users/rfinn/Ureka/variants/common/lib/python2.7/site-packages/singledispatch.pyc in wrapper(*args, **kw)
208
209 def wrapper(*args, **kw):
--> 210 return dispatch(args[0].__class__)(*args, **kw)
211
212 registry[object] = func
/Users/rfinn/Ureka/variants/common/lib/python2.7/site-packages/rpy2/robjects/conversion.pyc in py2ri(obj)
37 (ri) objects.
38 """
---> 39 raise NotImplementedError("Conversion 'py2ri' not defined for objects of type '%s'" % str(type(obj)))
40
41 @singledispatch
NotImplementedError: Conversion 'py2ri' not defined for objects of type '<type 'numpy.ndarray'>'
In [29]:
help(base.data_frame)
Help on DocumentedSTFunction in module rpy2.robjects.functions object:
class DocumentedSTFunction(SignatureTranslatedFunction)
| Method resolution order:
| DocumentedSTFunction
| SignatureTranslatedFunction
| Function
| rpy2.robjects.robject.RObjectMixin
| rpy2.rinterface.SexpClosure
| rpy2.rinterface.Sexp
| __builtin__.object
|
| Methods defined here:
|
| __init__(self, sexp, init_prm_translate=None, packagename=None)
|
| ----------------------------------------------------------------------
| Methods inherited from SignatureTranslatedFunction:
|
| __call__(self, *args, **kwargs)
|
| ----------------------------------------------------------------------
| Methods inherited from Function:
|
| formals(self)
| Return the signature of the underlying R function
| (as the R function 'formals()' would).
|
| rcall(self, *args)
| Wrapper around the parent method rpy2.rinterface.SexpClosure.rcall().
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Function:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from rpy2.robjects.robject.RObjectMixin:
|
| __str__(self)
|
| r_repr(self)
| String representation for an object that can be
| directly evaluated as R code.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from rpy2.robjects.robject.RObjectMixin:
|
| rclass
| R class for the object, stored as an R string vector.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from rpy2.robjects.robject.RObjectMixin:
|
| __rname__ = None
|
| ----------------------------------------------------------------------
| Data descriptors inherited from rpy2.rinterface.SexpClosure:
|
| closureenv
| Environment the object is defined in.
| This corresponds to the C-level function CLOENV(SEXP).
|
| :rtype: :class:`rpy2.rinterface.SexpEnvironment`
|
| ----------------------------------------------------------------------
| Methods inherited from rpy2.rinterface.Sexp:
|
| __deepcopy__(...)
| Makes a copy of the underlying Sexp object, and returns it.
|
| __getstate__(...)
| Returns a serialized object for the underlying R object
|
| __reduce__(...)
| Prepare an instance for serialization.
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __setstate__(...)
| set the state of an instance (dummy).
|
| do_slot(...)
| Returns the attribute/slot for an R object.
| The name of the slot (a string) is the only parameter for
| the method.
| :param name: string
| :rtype: instance of type or subtype :class:`rpy2.rinterface.Sexp`
|
| do_slot_assign(...)
| Set the attribute/slot for an R object.
|
| :param name: string
| :param value: instance of :class:`rpy2.rinterface.Sexp`
|
| list_attrs(...)
| Returns the list of attribute names.
|
| rsame(...)
| Is the given object representing the same underlying R object as the instance.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from rpy2.rinterface.Sexp:
|
| __sexp__
| Opaque C pointer to the underlying R object
|
| __sexp_refcount__
| Reference counter for the underlying R object
|
| named
| Integer code for the R object reference-pseudo counting.
| This method corresponds to the macro NAMED.
| See the R-extensions manual for further details.
|
| rid
| ID for the associated R object (Hint: that's a memory address)
|
| typeof
| R internal SEXPREC type.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from rpy2.rinterface.Sexp:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
In [ ]:
Content source: rfinn/LCS
Similar notebooks: