How to make your own R package

Use Rstudio, click Create a new R Package, the package name to the Road King and you want to create.

 Click Create Project, the following will generate several files. Where R folder where you saved your script.

Finally, build and reload it into the big announcement. If you want other users to install, you can build binary Package, build Source Package, will produce two fresh compressed file in your project path, use install.packages ( "D: /tempworkspace/lncRNAtools_0.1.0.tar.gz", repos = NULL) installation, the installation is successful successful library.

Questions: 1: How to Import package, two options, one is to enter the import (package name) in the NAMESPACE file, another good method is to use roxygen2 package. The following diagram, create a function documentation, use the command roxygenize ( '.'), Roxygen2 will automatically create NAMESPACE, if you need the original error NAMESPACE deleted, in fact the original NAMESPACE file and empty.

See results

Question 2: How do I add functional dependencies of data. Built "data" folder, into the save () after .RD or .RData file, so you can use the function.

Released four original articles · won praise 3 · Views 197

Guess you like

Origin blog.csdn.net/zxl596085278/article/details/103399115