R語言
class.ind
位於 nnet
包(package)。 說明
根據給定因子生成類別指示函數。
用法
class.ind(cl)
參數
cl |
案例類的因子或向量。 |
值
一個矩陣,除了與該類對應的列之外,其餘均為零。
例子
# The function is currently defined as
class.ind <- function(cl)
{
n <- length(cl)
cl <- as.factor(cl)
x <- matrix(0, n, length(levels(cl)) )
x[(1:n) + n*(unclass(cl)-1)] <- 1
dimnames(x) <- list(names(cl), levels(cl))
x
}
參考
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
相關用法
- R nnet 擬合神經網絡
- R which.is.max 求向量中的最大位置
- R predict.nnet 通過訓練有素的神經網絡預測新示例
- R nnetHess 評估神經網絡的 Hessian 矩陣
- R multinom 擬合多項對數線性模型
- R Pixel X 射線像素強度隨時間的變化
- R corARMA ARMA(p,q) 相關結構
- R getGroupsFormula 提取分組公式
- R corRatio 有理二次相關結構
- R logLik.glsStruct glsStruct 對象的對數似然
- R intervals.lmList lmList 係數的置信區間
- R corLin 線性相關結構
- R plot.augPred 繪製 augPred 對象
- R print.varFunc 打印 varFunc 對象
- R recalc 重新計算壓縮線性模型對象
- R Variogram.corSpher 計算 corSpher 對象的半變異函數
- R getGroups.lme 提取 lme 對象組
- R nlmeStruct 非線性混合效應結構
- R predict.nlme 來自 nlme 對象的預測
- R corSymm 一般相關結構
- R qqnorm.gls gls 對象殘差的正態圖
- R pdCompSymm 具有複合對稱結構的正定矩陣
- R [.pdMat 下標 pdMat 對象
- R pdConstruct.pdBlocked 構造 pdBlocked 對象
- R gapply 按組應用函數
注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Generates Class Indicator Matrix from a Factor。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。