observe_if: Observe your data

Description Usage Arguments Value Examples

View source: R/observe.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
observe_if(.data, ..., .append = TRUE)

observe_if_(.data, ..., .dots, .append = TRUE)

## S3 method for class 'data.frame'
observe_if_(.data, ..., .dots, .append = TRUE)

## S3 method for class 'tbl_df'
observe_if_(.data, ..., .dots, .append = TRUE)

## S3 method for class 'grouped_df'
observe_if_(.data, ..., .dots, .append = TRUE)

observe(.data, ...)

## Default S3 method:
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

1
2
3
4
5
6
7
8
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()

observer documentation built on May 1, 2019, 8:04 p.m.