package.skeleton()関数

  • Windows環境でのpackage.skeleton()を用いたパッケージづくりはこちら
  • package.skeleton()関数がつくるもの
    • パッケージ名"hoge"
    • 関数"fx1","fx2"
    • データとしてのオブジェクト"d"
  • 実行コマンド
package.skeleton("hoge",c("fx1","fx2","d"))
  • できるものの構成
-hoge/data/d.rda # バイナリファイル
-----/man/d.Rd # 説明ファイル
----------fx1.Rd # 説明ファイル
----------fx2.Rd # 説明ファイル
----------hoge-package.Rd # 説明ファイル
-----/R/fx1.R # 関数ファイル
--------fx2.R # 関数ファイル
-----DESCRIPTION # 全体説明ファイル
  • 説明ファイルのタイトルとexamplesを書き換えよう
    • DESCRIPTIONファイル
Package: hoge
Type: Package
Title: !!!ここを書こう!!!
Version: 1.0
Date: 2011-02-12
Author: Who wrote it
Maintainer: Who to complain to <yourfault@somewhere.net>
Description: More about what it does (maybe more than one line)
Depends: clue, kinship, gtools(などと、依存パッケージを書く)
License: What license is it under?
LazyLoad: yes
    • パッケージのRdファイル"hoge-package.Rd"
\name{hoge-package}
\alias{hoge-package}
\alias{hoge}
\docType{package}
\title{
!!!!ここを書こう。短文で!!!!
}
\description{
!!!!ここも書こう。数行で。忘れないために!!!!
}
\details{
\tabular{ll}{
Package: \tab hoge\cr
Type: \tab Package\cr
Version: \tab 1.0\cr
Date: \tab 2011-02-12\cr
License: \tab What license is it under?\cr
LazyLoad: \tab yes\cr
}
~~ An overview of how to use the package, including the most important ~~
~~ functions ~~
}
\author{
Who wrote it

Maintainer: Who to complain to <yourfault@somewhere.net>
~~ The author and/or maintainer of the package ~~
}
\references{
~~ Literature or other references for background information ~~
}
~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~
~~ the R documentation directory ~~
\keyword{ package }
\seealso{
~~ Optional links to other man pages, e.g. ~~
~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
}
\examples{
!!!!!ここを書く!!!!!
}
    • 関数のRdファイル"fx1.Rd"
\name{fx1}
\alias{fx1}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
!!!!ここを書く!!!!
}
\description{
%%  ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
fx1()
}
%- maybe also 'usage' for other objects documented here.
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
!!!!ここを書く!!!!!
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
    • データオブジェクトのRdファイル"d.Rd"
\name{d}
\alias{d}
\docType{data}
\title{
!!!!ここを書く!!!!
}
\description{
%%  ~~ A concise (1-5 lines) description of the dataset. ~~
}
\usage{data(d)}
\format{
  The format is:
 NULL
}
\details{
%%  ~~ If necessary, more details than the __description__ above ~~
}
\source{
%%  ~~ reference to a publication or URL from which the data were obtained ~~
}
\references{
%%  ~~ possibly secondary sources and usages ~~
}
\examples{
data(d)
## maybe str(d) ; plot(d) ...
}
\keyword{datasets}