Drop empty (with all NA's) rows/columns from data.frame/table
By default tables produced by functions tables, cro,
cro_fun and cro_fun_df are created with all
possible value labels. If values for this labels are absent in variable there
are NA's in rows and columns.
drop_empty_rows
/drop_empty_columns
are intended to remove
these empty rows/columns. drop_r
and drop_c
are the same
functions with shorter names. drop_rc
drops rows and columns
simultaneously.
drop_empty_rows(x, excluded_rows = NULL, excluded_columns = NULL) drop_empty_columns(x, excluded_rows = NULL, excluded_columns = NULL) drop_r(x, excluded_rows = NULL, excluded_columns = NULL) drop_c(x, excluded_rows = NULL, excluded_columns = NULL) drop_rc(x)
x |
data.frame/etable(result of cro and etc.) |
excluded_rows |
character/logical/numeric rows which won't be dropped
and in which NAs won't be counted. If it is characters then they will be
considered as pattern/vector of patterns. Patterns will be matched with
Perl-style regular expression with values in the first column of |
excluded_columns |
logical/numeric/characters columns which won't be dropped and in which NAs won't be counted. By default for class 'etable' it is first column - column with labels in table. |
data.frame with removed rows/columns
data(mtcars) mtcars = apply_labels(mtcars, vs = "Engine", vs = num_lab(" 0 V-engine 1 Straight engine 9 Other "), am = "Transmission", am = num_lab(" 0 Automatic 1 Manual 9 Other ") ) with_empty = calculate(mtcars, cro(am, vs)) drop_empty_rows(with_empty) drop_empty_columns(with_empty) drop_rc(with_empty)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.