Nothing

knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(dplyr) library(tibble) library(observer)

The observer package checks that a given dataset passes user-specified rules. The main functions are `observe_if`

and `inspect`

.

For instance, according to the documentation of the `diamonds`

dataset in package `ggplot2`

,
the column `depth`

is equal to `100*2*z/(x+y)`

.
Let us make an observation of this:

df <- ggplot2::diamonds %>% mutate(depth2 = 100*2*z/(x+y)) %>% observe_if(x > 0, y > 0, z > 0, abs(depth-depth2) < 1) obs(df)

We observe that 93 rows fail to satisfy this rule.
To go further we need to see what is happening; with `inspect`

we can select the rows at stake:

inspect(df, 4)

Another way is to write it with standard evaluation:

## Write your predicates first p <- c(~ x > 0, ~ y > 0, ~ z > 0, ~ abs(depth-depth2) < 1) ## Make observations df %>% observe_if_(.dots = p) %>% obs()

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.