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.