I have R generating some .csv files for another python program to run in another folder, I know it is possible to call bash from R but how could I call the command make
in my ubuntu virtual machine in another directory?
Asked
Active
Viewed 49 times
1

chicks
- 2,393
- 3
- 24
- 40

Angus Campbell
- 563
- 4
- 19
1 Answers
3
The simple way is creating an script to cd to your dir and exec make after that
script <- tempfile()
fhandle <- file(script)
writeLines("( cd /your_directory && make )",con=fhandle)
system2("/bin/bash",args=c(script))
You may need to find the correct path to /bin/bash, mine is from MacOs
You can work with system2 parameters to control what happens with output from make command and if you want to run the process in parallel with your R task or wait for completion.

Miguel Suazo
- 331
- 1
- 4