Make binary dummy variables out of a factor vector
出的一个因素向量的二元虚拟变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Make binary dummy variables out of a factor vector
出的一个因素向量的二元虚拟变量
用法----------Usage----------
mad(x, red = TRUE)
参数----------Arguments----------
参数:x
A factor vector. Or a vector that is convertible to a factor.
一个因素向量。或向量转换的一个因素。
参数:red
Logical. Shall redundancy be retained? When a factor variable is broken down to binary dummy variables it is typically not wanted to transfer all levels to 0/1 vectors but to skip the last level because the information is already contained in the sum of the other variables.
逻辑。应冗余保留吗?当被分解的一个因素变量的二元虚拟变量,它通常是不想要的,把所有水平为0/1向量,而是要跳过的最后一个级别,因为信息已经包含在其他变量的总和。
值----------Value----------
Returns a data.frame with binary data (0/1) with as many (n) rows as x has levels (with red=TRUE) or with n-1 levels when red=FALSE.
二进制数据(0/1),(N)与尽可能多的行为X的水平(red= TRUE)返回一个数据框或具有n-1水平时,red= FALSE。
## load bernina data[#负载BERNINA数据]
data(bernina)
## have a look at summit$year[看看首脑年]
summits$year
## make binary dummies from that[#二进制假人从]
mad(summits$year)