Description Usage Arguments Examples
FillIn
uses values of a variable from one data set to fill in missing
values in another.
1 2 |
D1 |
the data frame with the variable you would like to fill in. |
D2 |
the data frame with the variable you would like to use to fill in
|
Var1 |
a character string of the name of the variable in |
Var2 |
an optional character string of variable name in |
KeyVar |
a character vector of variable names that are shared by
|
allow.cartesian |
logical. See the |
KeepD2Vars |
logical, indicating whether or not to keep the variables
from D2 in the output data frame. The default is |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Create data set with missing values
naDF <- data.frame(a = sample(c(1,2), 100, rep = TRUE),
b = sample(c(3,4), 100, rep = TRUE),
fNA = sample(c(100, 200, 300, 400, NA), 100, rep = TRUE))
# Created full data set
fillDF <- data.frame(a = c(1, 2, 1, 2),
b = c(3, 3, 4, 4),
j = c(5, 5, 5, 5),
fFull = c(100, 200, 300, 400))
# Fill in missing f's from naDF with values from fillDF
FilledInData <- FillIn(naDF, fillDF, Var1 = "fNA",
Var2 = "fFull", KeyVar = c("a", "b"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.