Description Usage Arguments Value Examples
When some part of the data is missing, the missing information may be recovered from another source of information. This function scans all variables which are thought to include essentially the same information, and pulls value from a variable which is not missing.
1 2 |
data |
a data.frame in which variables are included |
varlist |
a character vector of variable list which is assumed to contain the same information. |
check |
a logical value specifying whether to scan all variables in varlist for incompatible values or not. |
choose |
a character value specifying which to choose among incompatible values. To choose ‘first’ or ‘last’ depends on the order of the data. ‘lower’ and ‘upper’ cannot be used for character variables. This option works only when check option is enabled (set to TRUE). |
a vector including one set of values obtained from varlist.
1 2 3 | dat <- data.frame(a1=c(NA,2,3), a2=c(1,NA,2), a3=c(1,2,NA), b=c(10,11,20))
dat
pullOneValue(dat, c("a1", "a2", "a3"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.