Stephan
Stephan

Reputation: 119

How can I get a Makefile from an existing R package?

I like the GBM package in R.

I can't get R's memory management to work with the combination of my machine/data set/task needed for reasons that have been covered elsewhere and should be considered off topic for the purposes of this question.

I would like to "rip" out the GBM algorithm away from R and rebuild it as standalone code.

Unfortunately there is no Makefile in the package tarball (or indeed any R package tarball I've seen). Is there a place I can look for straightforward Makefiles of R packages? Or do I really have to go way back to ground zero and write my own Makefile for the long painful journey ahead?

Upvotes: 1

Views: 727

Answers (2)

Paul Hiemstra
Paul Hiemstra

Reputation: 60984

You could also take a look at CMake which can quite easily create makefiles for you. It took me minimal time to get it working for a project of mine.

Upvotes: 0

Dirk is no longer here
Dirk is no longer here

Reputation: 368579

As Henry Spencer quipped: "Those who do not understand Unix are doomed to reinvent it, poorly."

R packages do not have a Makefile because R creates one on the fly when building the package, using both the defaults of the current R installation and the settings in the package, typically via a file Makevars.

Run the usual command R CMD INSTALL foo_1.2.3.tar.gz and you will see the effect of the generated Makefile as the build proceeds. Worst case you can always start by copying and pasting.

Upvotes: 7

Related Questions