0

I am in the following situation and in possession of the following files:

  • R script that preprocesses my data

  • Python script that takes in the processed data (ran with R above) and outputs predictions from various models

Due to the lack of time I am unable to rewrite the preprocessing or modelling so that I have a standalone script in a single language.

My objective is to have an executable that runs all of the above processes (performed in R & Python).

To add on, I know how to create Python and R executables for each script.

Is it possible to create such an executable that runs both the R and Python scripts?

Stoner
  • 706
  • 1
  • 8
  • 22
  • 1
    Perhaps you can try calling external commands via Python to execute the R script. I'm assuming that the data processed by R is saved to a file or DB that Python can access, rather than passing it in memory during execution. https://stackoverflow.com/questions/89228/calling-an-external-command-in-python – Jeremy Hue Aug 01 '19 at 10:11
  • @JeremyHue Thanks for your valuable input. Just to clarify, do you mean something like
    => => ?
    – Stoner Aug 01 '19 at 10:17
  • @JeremyHue Or is there some sequence at which I have to call the subprocess? I apologize for any confusion that I may have caused.. – Stoner Aug 01 '19 at 10:18
  • 1
    Just from my understanding of what you want to do, you need to: 1. Execute R script to pre-process data 2. Execute Python script to get outputs from data So having both scripts execute via subprocess in a separate Python script could work. Alternatively, you could add execution of the R script (as an executable) as the first thing in the Python script that takes in the processed data. – Jeremy Hue Aug 01 '19 at 10:21
  • @JeremyHue Got it, thanks. I'll try to work it out and update this thread should I encounter further problems or when I am able to complete the task. – Stoner Aug 01 '19 at 10:23

0 Answers0