Learn R Programming

observer (version 0.1.2)

observe_if: Observe your data

Description

observe_if identifies rows of .data where the predicates tested fail.

Usage

observe_if(.data, ..., .append = TRUE)
observe_if_(.data, ..., .dots, .append = TRUE)
"observe_if_"(.data, ..., .dots, .append = TRUE)
"observe_if_"(.data, ..., .dots, .append = TRUE)
"observe_if_"(.data, ..., .dots, .append = TRUE)
observe(.data, ...)
"observe"(.data, ...)

Arguments

.data
A tbl or data.frame.
...
Logical predicates. Multiple conditions are considered as separate observations.
.append
logical. If TRUE (the default), the observations attribute, in case it already exists before the call, is appended; if FALSE it is updated.
.dots
Used to work around non-standard evaluation.

Value

.data is returned together with an observations attribute. This attribute is a data frame (actually a tibble) which contains all check runs.

Examples

Run this code
library(magrittr)

df <- data.frame(x = 1:3, y = 2:4)
df %>% 
  observe_if(y-x==1) %>% 
  observe_if(x < 3) %>% 
  observe_if(y < 4, x > 1) %>% 
  obs()

Run the code above in your browser using DataLab