Description Usage Arguments Value Examples
fill_blank
fills any empty "" strings in a data.frame
character column with the corresponding values from another character,
numeric, or boolean column in the same data.frame.
1 | fill_blank(df, blank_col, fill_col)
|
df |
data.frame |
blank_col |
quoted name of character column in |
fill_col |
quoted name of character, numeric, or boolean column in
|
df
with empty strings in a specific character column filled
with strings from another column.
1 2 3 4 5 6 7 8 9 10 | # make data.frame with blanks
# columns must be data type = character
df <- data.frame(name1 = c("Bob", "Jane", "Henry"),
name2 = c("Mary", "", ""),
num1 = c(1, 2, 3),
num2 = c("", "", 7),
stringsAsFactors = FALSE)
# fill blanks in names2
df <- fill_blank(df, "name2", "name1")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.