manuparra / oc2dm

Open Cloud Computing Data Mining Platform
https://dicits.ugr.es/occml
MIT License
3 stars 1 forks source link

Use R Code to execute Python R Wrapper #19

Closed manuparra closed 7 years ago

manuparra commented 7 years ago

Use the next code for example in Linear Regression

dataset="/tmp/mtcars.csv"
inputparameters=",na.action=na.omit"
formula="mpg~disp"
output="/tmp/model_lm.Rda"

ro.r("""
        dataset = read.csv(file="{0}", header = TRUE)
        resultfit = lm(formula="{1}", data=dataset,{2})
        save(resultfit, file="{3}")
     """.format(dataset, formula, inputparameters, output))

Function ro.r(".....") will execute everything inside R code.

Mancuerna commented 7 years ago

Done.