Execute independent python and R scripts from a python script

135 views Asked by At

I have several python and R scripts that perform data wrangling and statistics operations. Each script access some data, performs some operations, and saves the output. The scripts are not dependent in any way when they are being excecuted. Further, they do not require any arguments.

I execute them one by one in the order I need, but they are becoming too many. Hence, I want to write a python script that enables me to execute them automatically. For example:

script1.py

  import pickle
  alfa = [1,2,3]
  pickle.dump(alfa,'file1.pkl','wb')

script2.py

    import pickle
    beta = [3,4,5]
    pickle.dump(beta,'file2.pkl','wb')

script3.R

    library(ggplot2)
    df = as.data.frame(upsilon= c(1,1,1),gamma=(2,3,4))
    g = ggplot() {plot with df}
    ggsave()

The script I need

   import gc
   import ...

   execute script1.py
   execute script2.py
   execute script3.R

How can I proceed?

Kind regards

0

There are 0 answers