View source: R/quest_functions.R
| partial.cases | R Documentation |
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.
partial.cases(data, vrb.nm, ov.min = 1, prop = TRUE, inclusive = TRUE)
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 |
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.
complete.cases
rowNA
ncases
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.