Difference between revisions of "Talk:NutriTools.R"

From Organic Design wiki
(Correct install usage)
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=Details=
 
=Details=
The structure of this category and subcategories is very consise. It is based on the build process of the [http://cran.stat.auckland.ac.nz R] function
+
These notes use the [http://cran.stat.auckland.ac.nz R] function [http://spider.stat.umn.edu/R/library/utils/html/package.skeleton.html package.skeleton] to create a contributed package template from a file of functions. If Help files are present in a man directory they are also copied across.
[http://spider.stat.umn.edu/R/library/utils/html/package.skeleton.html package.skeleton] which is used to create a contributed package template.
 
  
*Names of articles correspond to filenames for the package builds
 
*Subcategories of this package are in the same structure as the package directory structure
 
 
=Developers=
 
 
==Build process==
 
==Build process==
 
Download the text file contents of [[NutriTools.R]] into a temporary directory. In [http://cran.stat.auckland.ac.nz R], using that directory as your working directory, create a skeleton from a list of functions in a working .RData directory;
 
Download the text file contents of [[NutriTools.R]] into a temporary directory. In [http://cran.stat.auckland.ac.nz R], using that directory as your working directory, create a skeleton from a list of functions in a working .RData directory;
<pre>
+
 
rm(list=ls())
+
rm(list=ls())
source("NutriTools.R")
+
source("NutriTools.R")
package.skeleton(name="NutriTools", force=TRUE)
+
package.skeleton(name="NutriTools", force=TRUE)
dest        <- "NutriTools"
+
dest        <- "NutriTools"
buildMan    <- file.path(dest,"man")
+
buildMan    <- file.path(dest,"man")
buildManDest <- "man_build"  
+
buildManDest <- "man_build"
myManPages  <- "man"
+
myManPages  <- "man"
# Copy build template man pages to buildManDest directory
+
# Copy build template man pages to buildManDest directory
for( i in dir(buildMan)) {
+
for( i in dir(buildMan)) {
  print(i)
+
  print(i)
  file.copy(from=file.path(buildMan, i), to=file.path(buildManDest,i), overwrite=FALSE)
+
  file.copy(from=file.path(buildMan, i), to=file.path(buildManDest,i), overwrite=FALSE)
}
+
}
# Copy my new man pages to build directory
+
# Copy my new man pages to build directory
for( i in dir(myManPages, pattern="<tt>[</tt>[:alpha:]]$")) {
+
for( i in dir(myManPages, pattern="<tt>[</tt>[:alpha:]]$")) {
  print(i)
+
  print(i)
  file.copy(from=file.path(myManPages, i), to=file.path(buildMan,i), overwrite=TRUE)
+
  file.copy(from=file.path(myManPages, i), to=file.path(buildMan,i), overwrite=TRUE)
}
+
}
# Remove file "Read-and-delete-me"
+
# Remove file "Read-and-delete-me"
unlink(file.path(dest, "Read-and-delete-me"))
+
unlink(file.path(dest, "Read-and-delete-me"))
# copy DESCRIPTION file
+
# copy DESCRIPTION file  
file.copy(from="DESCRIPTION", to=file.path(dest,"DESCRIPTION"), overwrite=TRUE)
+
file.copy(from="DESCRIPTION", to=file.path(dest,"DESCRIPTION"), overwrite=TRUE)
</pre>
+
 
 
To build and install the R Package, the following commands are run In the filesystem parent directory of the R Package.
 
To build and install the R Package, the following commands are run In the filesystem parent directory of the R Package.
 
  R CMD check NutriTools
 
  R CMD check NutriTools
  R CMD INSTALL --build NutriTools_[VERSION].tar.gz
+
  R CMD INSTALL --build NutriTools
 
To create a windows zip file on OS X/linux (doesn't include CHM help files), run the following bash shell script;
 
To create a windows zip file on OS X/linux (doesn't include CHM help files), run the following bash shell script;
<pre>
+
 
#!/bin/bash
+
#!/bin/bash
# Rename tar.gz
+
# Rename tar.gz  
mv NutriTools_1.0-0_R_powerpc-apple-darwin8.8.0.tar.gz NutriTools_1.0-0.tar.gz
+
mv NutriTools_1.0-0_R_powerpc-apple-darwin8.8.0.tar.gz NutriTools_1.0-0.tar.gz
# Destroy the source build from package.skeleton
+
# Destroy the source build from package.skeleton
rm -rf NutriTools
+
rm -rf NutriTools
# Create a packaged version of the NutriTools directory structure
+
# Create a packaged version of the NutriTools directory structure
tar -zxvf NutriTools_1.0-0.tar.gz
+
tar -zxvf NutriTools_1.0-0.tar.gz
# Create a zip archive for windows
+
# Create a zip archive for windows
zip -r NutriTools.zip NutriTools
+
zip -r NutriTools.zip NutriTools
</pre>
 

Latest revision as of 00:27, 14 March 2007

Details

These notes use the R function package.skeleton to create a contributed package template from a file of functions. If Help files are present in a man directory they are also copied across.

Build process

Download the text file contents of NutriTools.R into a temporary directory. In R, using that directory as your working directory, create a skeleton from a list of functions in a working .RData directory;

rm(list=ls())
source("NutriTools.R")
package.skeleton(name="NutriTools", force=TRUE)
dest         <- "NutriTools"
buildMan     <- file.path(dest,"man")
buildManDest <- "man_build"  
myManPages   <- "man"
# Copy build template man pages to buildManDest directory
for( i in dir(buildMan)) {
  print(i)
  file.copy(from=file.path(buildMan, i), to=file.path(buildManDest,i), overwrite=FALSE)
}
# Copy my new man pages to build directory
for( i in dir(myManPages, pattern="[[:alpha:]]$")) {
  print(i)
  file.copy(from=file.path(myManPages, i), to=file.path(buildMan,i), overwrite=TRUE)
}
# Remove file "Read-and-delete-me"
unlink(file.path(dest, "Read-and-delete-me"))
# copy DESCRIPTION file 
file.copy(from="DESCRIPTION", to=file.path(dest,"DESCRIPTION"), overwrite=TRUE)

To build and install the R Package, the following commands are run In the filesystem parent directory of the R Package.

R CMD check NutriTools
R CMD INSTALL --build NutriTools

To create a windows zip file on OS X/linux (doesn't include CHM help files), run the following bash shell script;

#!/bin/bash
# Rename tar.gz 
mv NutriTools_1.0-0_R_powerpc-apple-darwin8.8.0.tar.gz NutriTools_1.0-0.tar.gz
# Destroy the source build from package.skeleton
rm -rf NutriTools
# Create a packaged version of the NutriTools directory structure
tar -zxvf NutriTools_1.0-0.tar.gz
# Create a zip archive for windows
zip -r NutriTools.zip NutriTools