順序なしカテゴリの2軸が作る分割表の空間配置

  • 予定パッケージ名
  • 関数名
    • CategoryVector2D
  • タイトル
CategoryVector2D
  • 説明
NxMテーブルは(N-1)x(M-1)自由度。NxMテーブルを(N-1)x(M-1)次元空間上の点に対応付ける
  • 使用例
N<-5
M<-4
CategoryVector2D(N,M)
  • ソース
CategoryVector2D2<-function(N = 3, M = 4){
	cvN <- CategoryVector(N)
	cvM <- CategoryVector(M)
	m <- matrix(0, N * M, (N - 1) * (M - 1))
	counter<-1
	#mm<-array(0,c(N,M,(N-1),M-1))
	#mm<-array(0,c(N,M,(N-1),M-1))
	for(i in 1:N){
		for(j in 1:M){
			#mm[i,j,,]<-(cvN[i,])%*%t(cvM[j,])
			m[counter,]<-c(t((cvN[i,])%*%t(cvM[j,])))
			counter<-counter+1
		}
	}
	m
}

  • Rdファイル
\name{CategoryVector2D}
\alias{CategoryVector2D}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
CategoryVector2D
}
\description{
N+1個の頂点を持つN単体はN次元空間におさまる。その頂点座標を出す関数

}
\usage{
N<-5
M<-4
CategoryVector2D(N,M)
}
%- maybe also 'usage' for other objects documented here.
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
ncx(nc-1)行列
}
\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{
N<-5
M<-4
CategoryVector2D(N,M)
  • 参考 旧版
CategoryVector2D.old<-
function (N = 3, M = 4) 
{
    cvN <- CategoryVector(N)
    cvM <- CategoryVector(M)
    m <- matrix(0, N * M, (N - 1) * (M - 1))
    counter1 <- 1
    counter2 <- 1
    for (i in 1:N) {
        for (j in 1:M) {
            counter2 <- 1
            for (k in 1:(N - 1)) {
                for (l in 1:(M - 1)) {
                  m[counter1, counter2] <- cvN[i, k] * cvM[j, 
                    l]
                  counter2 <- counter2 + 1
                }
            }
            counter1 <- counter1 + 1
        }
    }
    m
}
N<-4
M<-5
cc<-CategoryVector2D(N,M)
cc2<-CategoryVector2D.old(N,M)
cc-cc2