Nick
Nick

Reputation: 3374

How to execute a makefile from R

I am new to using makefiles in R, so excuse the really simple question: How do I execute a makefile which resides in a folder using R?

Is there a way to do so using a .R script? If so, what would the command line include?

Upvotes: 4

Views: 2078

Answers (1)

Nick
Nick

Reputation: 3374

I found the following solution to my problem in calling make using R (assuming you use Windows and RStudio):

Turns out you first need to add Rtools to your PATH

  • Select Avanced System Settings / Environment Variables / System Variables New.
  • Add the following to PATH:

    • C:\Rtools\gcc-4.6.3\bin
    • C:\Rtools\bin
    • Now Reboot.
  • After this is done, reopen your R console. Now you can use @yihui's servr package, and call a folder containing a makefile as follows:

    servr::make(dir="path containing Makefile")
    

Hope this helps other newbies to makefile too...

Upvotes: 4

Related Questions