R language makes its own R package, detailed process

Source: Internet
Author: User

1, enter http://mirrors.xmu.edu.cn/CRAN/bin/windows/Rtools/download Rtools, and install

2, enter Http://www.miktex.org/2.9/setup, download MiKTeX 2.9, and install

3. Set environment variable in path D:\Program files\rtools\bin;d:\program files\rtools\gcc-4.6.3\bin;d:\program Files\programs\miktex 2.9\miktex\bin;d:\r\r-3.2.5\bin; (according to your own installed directory)

4. After completing the above steps, open the CMD Command Line window and enter R cmd–help to detect if the R environment is successfully configured

5. Build a R_package folder under the local D drive, and will be hello. R file into the change folder, hello. The contents of the R file are as follows:

Hello <-function (name) {
Print (Paste ("Hi", name))
}

6. Open the R graphical user interface and enter

SETWD ("D:/r_package")
Package.skeleton (name= "Hello", code_files= "D:/r_package/hello. R ")

7, at this time the D:/r_package file will generate a folder, open the "man" folder inside all the files, the title and example inside each file to make the following changes:

\title{
Be sure to write the title here
}
\examples{
Examples content is set to null
}

8. Open cmd Command Line window, go to command prompt,

Enter r CMD Build custom package name _1.0.tar.gz

#9, R CMD Check custom package name _1.0.tar.gz, if there is no error, the installation package is generated correctly;

9, enter the R graphical interface, input the following command:

Install.packages ("Custom package name _1.0.tar.gz", type= "source", Repos=null)

#10, enter library (custom package name), no error, import custom package successfully


That the correct installation package was successful. The 8th step to build the installation package file, the 9th step is to install their own R package, this step, has been packaged on my computer successfully, for reference only.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.