fillUp: Fills up a vector

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

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.

Usage

1
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.

Author(s)

Laurent Gatto <lg390@cam.ac.uk>

Examples

1
2
3
4
5
6
7
8
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])

MSnbase documentation built on Jan. 23, 2021, 2 a.m.