全サンプルを区別した分割表のための重みづけ表を作る

  • 予定パッケージ名
  • 関数名
    • MakeWTable
  • タイトル
MakeWTable
  • 説明
サンプルに値が与えられているときに、サンプル数xカテゴリ数の表に重みづけをつけることとする。
カテゴリには0:(カテゴリ数-1)の順序を付けるものとして重みづけする
  • 使用例
MakeWTable(g,k)
  • ソース
MakeWTable<-function(t,k=c(0,1)){
	n<-length(k)
	m<-matrix(0,n,length(t))
	for(i in 1:n){
		m[i,]<-t*k[i]
	}
	return(c(t(m)))
}
  • Rdファイル
\name{MakeWTable}
\alias{MMakeWTable}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
MakeWTable
}
\description{
サンプルに値が与えられているときに、サンプル数xカテゴリ数の表に重みづけをつけることとする。
カテゴリには0:(カテゴリ数-1)の順序を付けるものとして重みづけする
}
\usage{
MakeWTable(g,k)
}
\arguments{
\item{g}{サンプル数の長さのベクトル}
\item{k}{カテゴリの重みづけベクトル}
}
%- maybe also 'usage' for other objects documented here.
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
カテゴリ数xサンプル数であるようなベクトル
}
\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{
}
\examples{
Ns<-20
k<-c(0,1)
g<-sample(c(0,1,2),Ns,replace=TRUE)
w<-MakeWTable(g,k)