-
Notifications
You must be signed in to change notification settings - Fork 10
Building R packages for PC, Mac, and Linux or Unix
R packages can be built from the command line, though the syntax differs slightly across operating systems.
It's not yet clear when or even if you will need to do this, as you can always test code in development using the devtools
library, but it's useful to know how this works in case devtools
fails in some case, or we delegate package updating, or just for your own package development.
If your code is ready to be compiled into a binary (e.g., you've already git pull
'ed in the latest changes), you should open a terminal, change directory to the directory which contains your package source (e.g., the directory that contains the folder tile
), and run the following from the command line:
R CMD INSTALL --build tile
To compile the simcf binary, naturally replace tile
with simcf
above.
This will create a file with the extension .tgz
, which can be used to install the package in R on a Mac.
If your code is ready to be installed/updated from source into an R installation (e.g., you've already git pull
'ed in the latest changes), you should open a terminal, change directory to the directory which contains your package source (e.g., the directory that contains the folder tile
), and run the following from the command line:
R CMD BUILD tile
To compile the simcf source, naturally replace tile
with simcf
above.
This will create a file with the extension .tar.gz
, which can be used to install the package in R on a Linux or Unix machine, or to compile a PC binary using the next step.
If you use a Mac for development, first make a .tar.gz
source file using the instructions above. Then, go to this site, and click on "upload". You can upload your source file here, and within an hour or so a link to the compiled PC binary will be emailed to the maintainer email listed in the package DESCRIPTION
file. That's Chris Adolph by default, so if you want this file to be mailed to you, for testing purposes, you will need to substitute your email in the DESCRIPTION
file under Maintainer before compiling the source.
The file you receive will end in the extension .zip
, and can be used to install your package in R on a PC.