fillBlanks | R Documentation |
Fill blank entries in a vector
fillBlanks(x, blankGrep = c("[ \t]*"), first = "", ...)
x |
character vector |
blankGrep |
vector of grep patterns, or |
first |
options character string intended when the first
entry of |
... |
additional parameters are ignored. |
This function takes a character vector and fills any blank (missing) entries with the last non-blank entry in the vector. It is intended for situations like imported Excel data, where there may be one header value representing a series of cells.
The method used does not loop through the data, and should scale fairly well with good efficiency even for extremely large vectors.
Character vector where blank entries are filled with the most recent non-blank value.
Other jam string functions:
asSize()
,
breaksByVector()
,
cPasteSU()
,
cPasteS()
,
cPasteUnique()
,
cPasteU()
,
cPaste()
,
formatInt()
,
gsubOrdered()
,
gsubs()
,
makeNames()
,
mixedOrder()
,
mixedSortDF()
,
mixedSorts()
,
mixedSort()
,
mmixedOrder()
,
nameVectorN()
,
nameVector()
,
padInteger()
,
padString()
,
pasteByRowOrdered()
,
pasteByRow()
,
sizeAsNum()
,
tcount()
,
ucfirst()
,
uniques()
x <- c("A", "", "", "", "B", "C", "", "", NA,
"D", "", "", "E", "F", "G", "", "");
data.frame(x, fillBlanks(x));
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.