Convert source code (mypackage.tar.gz) to install windows (mypackage.zip) in R

Is it possible to convert the source code (mypackage.tar.gz) to the installation window (mypackage.zip) in R at home? How can I do it?

I can unzip tar.gz using 7-Zip. When I tried to recompile the following error message:

Downloading the required package: mypackage Error with error: '' mypackage is not a valid installed package

+4
source share
2 answers

No, you need to install Rtools and compile a binary package ending in .zip from the source package ending in .tar.gz . And the step of β€œcompiling” the package / building is necessary even for packages containing only R code.

Try one of the many guides on the Internet about creating packages on Windows.

Alternatively, use the win-builder website to create the package for you.

+9
source

I develop my R packages on Linux machines - if you do this too, this is what I do and it can help you.

To make .zip for R, I basically β€œinstall” it in a temporary directory and zip it. This .zip file can be used on Windows.

 # make the package: R CMD build my_package # make tmp directory mkdir tmp # install the package to temp directory R CMD INSTALL -l tmp my_package.tar.gz # zip it up cd tmp zip -r my_package.zip my_package # move your zip file back out and delete tmp directory mv my_package.zip ../ cd ../ rm -rf tmp 

I put all this in a makefile for convenience, so that I can enter (for example) make doc to create documentation (since I use roxygen2), make package to do R CMD build , make zip to convert. tar.gz to .zip etc.

+2
source

Source: https://habr.com/ru/post/1402347/


All Articles