pymer4.rfuncs#
Custom r-functions expressed as Python strings
- pymer4.rfuncs.get_summary(r_model)[source]#
Get an R-style summary print out from a model as a multi-line string
- pymer4.rfuncs.make_rfunc(r_code)[source]#
Make a function from an R code string useable with a python object.
Example
>>> # Make a function that returns the coefficients of a model >>> coef = make_rfunc(""" >>> function(model) { >>> output <- coef(model) >>> return(output) >>> } >>> """) >>> >>> # Use the function by passing in a model's .r_model attribute >>> ols = lm(mpg ~ hp + wt, data=mtcars) >>> ols.fit() >>> coefs = coef(ols.r_model)