fillUp(MSnbase)
fillUp()所属R语言包:MSnbase
Fills up a vector
填补了一个向量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function replaces all the empty characters "" and/or NAs with the value of the closest preceding the preceding non-NA/"" element. The function is used to populate dataframe or matrice columns where only the cells of the first row in a set of partially identical rows are explicitly populated and the following are empty.
此函数替换所有的空字符“""和/或NA与最接近的前前非NA/""元素的值。该函数用来填充dataframe或矩阵的列,其中只有部分相同的行集的第一行的单元明确填充,下面是空的。
用法----------Usage----------
fillUp(x)
参数----------Arguments----------
参数:x
a vector.
一个向量。
值----------Value----------
A vector as x with all empty characters "" and NA values replaced by the preceding non-NA/"" value.
一个为向量x所有空字符""和NA取而代之的是前面的非NA/""值的值。
作者(S)----------Author(s)----------
Laurent Gatto <lg390@cam.ac.uk>
举例----------Examples----------
d <- data.frame(protein=c("Prot1","","","Prot2","",""),
peptide=c("pep11","","pep12","pep21","pep22",""),
score=c(1:2,NA,1:3))
d
e <- apply(d,2,fillUp)
e
data.frame(e)
fillUp(d[,1])
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|