Created
November 13, 2015 10:30
-
-
Save thekensta/538a3c6e3f0faf43b89c to your computer and use it in GitHub Desktop.
Call power.prop.test via Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need to change the values extracted, serves as aide-memoire for R <-> Python | |
def parse_robj(obj): | |
"""Extract n, p1 and p2 from R List from power.prop.test. """ | |
return (obj[obj.names.index("n")][0], | |
obj[obj.names.index("p1")][0], | |
obj[obj.names.index("p2")][0]) | |
def call_power_prop_test(p1, n): | |
P__ = %R power.prop.test(p1=$p1, n=$n, power=0.8) | |
return parse_robj(P__) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment