Build R packages
With the R plugin for PyCharm, you can build your own R packages. The plugin provides you with the dedicated project type and handy UI tools to build, check, and test your sources.
To create a project, do one of the following:
From the main menu, choose
On the Welcome screen, click Create New Project
In the New Project dialog, select R Package from the available project types.
Specify the following parameters:
Location: the project directory name. This name is used to create a package title and construct filenames for all sources in the package.
Project interpreter: the project interpreter. Expand the Project interpreter area and click next to the Base interpreter field. In the file system, select the R executable file. A sample path to the R executable can be /usr/local/bin/R on macOS or C:\Program Files\R\R-3.6.1\bin\R.exe on Windows.
Chosen package manager: the primary tools for building R packages in the project. Expand More settings and select a package manager from the list: Packrat, Rcpp, RcppArmadillo, RcppEigen, or Devtools. If you leave this setting unchanged, the default package managed will be used.
Click OK to complete the task.
Expand the project content root in the Project tool window. The plugin has created all the required directories and template files.
Modify the source files and add all the required details according to the Writing R Extensions recommendations.
man: the directory that should contain documentation files for the objects in the package in R documentation (*.Rd) format.
R: the directory that contains only R code files.
DESCRIPTION: the file that contains basic information about the package in the specific format.
NAMESPACE: the file that can contain one or more useDynLib directives which allows shared objects that need to be loaded.
Read-and-delete-me: the package build instruction.
Optionally, you can create the src directory if you have any C, C++, or Fortran sources.
When all source files are added, you're ready to install and reload your package. In the Build tab of the R Tools window, click .
Once this done, the tarball file is create and the package is available for your own use.
To check if your package passes the
R CMD checkand can be uploaded to cran, click .
If case of any reported errors or warnings, click and test the package.
You can tune the build options. Click and deselect or keep selected the following checkboxes:
Each options is selected by default and represents a particular command-line option. Hover over a checkbox to see the corresponding option.