has_na | R Documentation |
This functions checks if variables or observations in a data
frame have NA
, NaN
or Inf
values.
has_na(x, ..., by = c("col", "row"), out = c("table", "df", "index"))
incomplete_cases(x, ...)
complete_cases(x, ...)
complete_vars(x, ...)
incomplete_vars(x, ...)
x |
A data frame. |
... |
Optional, unquoted names of variables that should be selected for
further processing. Required, if |
by |
Whether to check column- or row-wise for missing and infinite values.
If |
out |
Output (return) format of the results. May be abbreviated. |
If x
is a vector, returns TRUE
if x
has any missing
or infinite values. If x
is a data frame, returns TRUE
for
each variable (if by = "col"
) or observation (if by = "row"
)
that has any missing or infinite values. If out = "table"
, results
are returned as data frame, with column number, variable name and
label, and a logical vector indicating if a variable has missing values or
not. However, it's printed in colors, with green rows indicating that a
variable has no missings, while red rows indicate the presence of missings
or infinite values. If out = "index"
, a named vector is returned.
complete_cases()
and incomplete_cases()
are convenient
shortcuts for has_na(by = "row", out = "index")
, where the first
only returns case-id's for all complete cases, and the latter only for
non-complete cases.
complete_vars()
and incomplete_vars()
are convenient shortcuts
for has_na(by = "col", out = "index")
, and again only return those
column-id's for variables which are (in-)complete.
data(efc)
has_na(efc$e42dep)
has_na(efc, e42dep, tot_sc_e, c161sex)
has_na(efc)
has_na(efc, e42dep, tot_sc_e, c161sex, out = "index")
has_na(efc, out = "df")
has_na(efc, by = "row")
has_na(efc, e42dep, tot_sc_e, c161sex, by = "row", out = "index")
has_na(efc, by = "row", out = "df")
complete_cases(efc, e42dep, tot_sc_e, c161sex)
incomplete_cases(efc, e42dep, tot_sc_e, c161sex)
complete_vars(efc, e42dep, tot_sc_e, c161sex)
incomplete_vars(efc, e42dep, tot_sc_e, c161sex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.