DetectOnlyNonEmptyVarsInRows: detect rows with columns of non-NA vaues and other columns of...

Description Usage Arguments Value Examples

View source: R/DataCombine.R

Description

1
2
3
4
5
6
Detect columns(Var) where the values are
not-NA (determined by Ele) but
the rest of the columns are
NA everywhere else (determined by EleO).

The function is written in package DataCombine style.

Usage

1
DetectOnlyNonEmptyVarsInRows(x, Var = colnames(x), Ele = "All", EleO = "All")

Arguments

x

data.frame

Var

columns determining complete cases. Can be column names or positions.

Ele

"All"(default), of elements in Var, the test results. Other option is "Any".

EleO

"All"(default), of elements in 'other than Var', the test results. The other option is "Any".

Value

df with rows of all-NA removed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
res <- data.frame(A = c(1,NA,NA,NA,5,6), B = c(11,12,NA,NA,15,NA), C = c(101,102,103,NA,NA,NA))
res
   A  B   C
1  1 11 101
2 NA 12 102
3 NA NA 103
4 NA NA  NA
5  5 15  NA
6  6 NA  NA

DetectOnlyNonEmptyVarsInRows(res, Var = c("A","B"))
[1] FALSE FALSE FALSE FALSE  TRUE FALSE

## End(Not run)

AndreMikulec/econModel documentation built on June 30, 2021, 9:48 a.m.