inspect: Inspect observations

Description Usage Arguments See Also Examples

View source: R/inspect.R

Description

Once a table has been observed with observe_if, one may wish to dig into the observations made. The function inspect returns a sub-table of .data whose rows correspond to the rows identified by the observation ob.

Usage

1
inspect(.data, ob, cols = "all")

Arguments

.data

A tbl or data frame.

ob

integer. A row of the observations attribute to be inspected.

cols

character. One of "all", "most", "some". If cols = "all", all .data columns are kept in the result. If cols = "some", only columns that are concerned by the observation ob are kept. cols = "most" is like cols = "some", except that columns which are of type "character" or "factor" are also kept.

See Also

observe_if in this package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(magrittr)

df <- data.frame(id = c("a", "b", "c"), x = 1:3, y = 2:4, z = c(1.1, 10, 5))
df <- df %>% 
  observe_if(z==floor(z), 
             y-x==1, 
             x < 3) %>% 
  observe_if(y < 4, 
             x > 1)
  
print(obs(df))

df1 <- df %>%  
  inspect(ob = 5, cols="most")
print(obs(df1))

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