5

I have problem passing arguments to an imported function from a python module(via reticulate)

This code works in python but following code in R does not

from frs import frs
 frs(gender='F', time=10, age=35, bmi=24.3, sbp=122, ht_treat=False, smk=True, dia=False)

 X = ['m', 10, 30, 22.5, 125.0, True, True, True]
frs(*X) 

    #My unsuccessful attempt in R



    library(reticulate)

    frs= import('frs')

    ##Attempt1

    frs$frs(c('m', 10, 30, 22.5, 125.0, "True", "True", "True"))

    #attempt2

    gender= 'm'

    time=10

    age=35
    bmi =23.5

    sbp = 120
    ht_treat = TRUE
    smk = TRUE

    dia =TRUE

    frs$frs(c(gender,time,age,bmi,sbp,ht_treat,smk,dia)) 
anupam
  • 135
  • 1
  • 2
  • 7
  • When used from the R package `reticulate` the argument to `import` is supposed to be a Python package name. You appear to be attempting to use it to transfer data or function objects. Is there a Python package named `frs`? – IRTFM Jan 11 '19 at 14:43

1 Answers1

1

Call Python within R:

library(reticulate)
reticulate::repl_python()
import frs
frs(gender='F', time=10, age=35, bmi=24.3, sbp=122, ht_treat=False, smk=True, dia=False)
shwan
  • 538
  • 6
  • 21