partial.cases {quest} | R Documentation |
Find Partial Cases
Description
partial.cases
indicates which cases are at least partially observed,
given a specified frequency of observed values across a set of columns. This
function builds off complete.cases
. While
complete.cases
requires completely observed cases,
partial.cases
allows the user to specify the frequency of columns
required to be observed. The default arguments are equal to
complete.cases
.
Usage
partial.cases(data, vrb.nm, ov.min = 1, prop = TRUE, inclusive = TRUE)
Arguments
data |
data.frame or matrix of data. |
vrb.nm |
a character vector of colnames from |
ov.min |
minimum frequency of observed values required per row. If
|
prop |
logical vector of length 1 specifying whether |
inclusive |
logical vector of length 1 specifying whether the case
should be included if the frequency of observed values in a row is exactly
equal to |
Value
logical vector of length = nrow(data)
with names =
rownames(data)
specifying if the frequency of observed values is
greater than (or equal to, if inclusive
= TRUE) ov.min
.
See Also
Examples
cases2keep <- partial.cases(data = airquality,
vrb.nm = c("Ozone","Solar.R","Wind"), ov.min = .66)
airquality2 <- airquality[cases2keep, ] # all cases with 2/3 variables observed
cases2keep <- partial.cases(data = airquality,
vrb.nm = c("Ozone","Solar.R","Wind"), ov.min = 1, prop = TRUE, inclusive = TRUE)
complete_cases <- complete.cases(airquality)
identical(x = unname(cases2keep),
y = complete_cases) # partial.cases(ov.min = 1, prop = TRUE,
# inclusive = TRUE) = complete.cases()