View source: R/uniquePresent.R
uniquePresent | R Documentation |
Extract unique non-missing value from vector
uniquePresent(x, req.n1 = TRUE, na.pattern)
x |
A vector, either numeric or character. |
req.n1 |
Require one unique value? If 'TRUE' (default), an error is thrown if non-unique values found. If 'FALSE', all the unique values are returned. |
na.pattern |
In addition to NA-elements, what text strings should be considered missing? Default is empty strings and strings only containing white spaces ('na.pattern="^ *$"'). |
This function is particularly useful when combining data
sets of which only some contain certain
variables. uniquePresent
with 'req.n1=TRUE' makes sure the
result is a single unique value (e.g., within subjects). A
typical use is carrying subject-level covariates from one data
set to another in a longitudinal analysis.
a vector of same class as 'x'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.