# Explore and summarize data

Source: `R/explore.R`
`explore.Rd`

Explore and summarize data

    explore(
      dataset,
      vars = "",
      byvar = "",
      fun = c("mean", "sd"),
      top = "fun",
      tabfilt = "",
      tabsort = "",
      tabslice = "",
      nr = Inf,
      data_filter = "",
      arr = "",
      rows = NULL,
      envir = parent.frame()
    )

## Arguments

dataset

  Dataset to explore

vars

  (Numeric) variables to summarize

byvar

  Variable(s) to group data by

fun

  Functions to use for summarizing

top

  Use functions ("fun"), variables ("vars"), or group-by variables as column headers

tabfilt

  Expression used to filter the table (e.g., "Total > 10000")

tabsort

  Expression used to sort the table (e.g., "desc(Total)")

tabslice

  Expression used to filter table (e.g., "1:5")

nr

  Number of rows to display

data_filter

  Expression used to filter the dataset before creating the table (e.g., "price > 10000")

arr

  Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

  Rows to select from the specified dataset

envir

  Environment to extract data from

## Value

A list of all variables defined in the function as an object of class explore

## Details

See https://radiant-rstats.github.io/docs/data/explore.html for an example in Radiant

## See also

See `summary.explore` to show summaries

## Examples

    explore(diamonds, c("price", "carat")) %>% str()
    #> List of 13
    #>  $ tab        :'data.frame':	2 obs. of  3 variables:
    #>   ..$ variable: Factor w/ 2 levels "price","carat": 1 2
    #>   ..$ mean    : num [1:2] 3907.186 0.794
    #>   ..$ sd      : num [1:2] 3956.915 0.474
    #>   ..- attr(*, "radiant_nrow")= int 2
    #>  $ df_name    : chr "diamonds"
    #>  $ vars       : chr [1:2] "price" "carat"
    #>  $ byvar      : NULL
    #>  $ fun        : chr [1:2] "mean" "sd"
    #>  $ top        : chr "fun"
    #>  $ tabfilt    : chr ""
    #>  $ tabsort    : chr ""
    #>  $ tabslice   : chr ""
    #>  $ nr         : num Inf
    #>  $ data_filter: chr ""
    #>  $ arr        : chr ""
    #>  $ rows       : NULL
    #>  - attr(*, "class")= chr [1:2] "explore" "list"
    explore(diamonds, "price:x")$tab
    #>   variable         mean           sd
    #> 1    price 3.907186e+03 3956.9154001
    #> 2    carat 7.942833e-01    0.4738263
    #> 3  clarity 1.333333e-02    0.1147168
    #> 4      cut 3.366667e-02    0.1803998
    #> 5    color 1.273333e-01    0.3334016
    #> 6    depth 6.175267e+01    1.4460279
    #> 7    table 5.746533e+01    2.2411022
    #> 8        x 5.721823e+00    1.1240545
    explore(diamonds, c("price", "carat"), byvar = "cut", fun = c("n_missing", "skew"))$tab
    #>          cut variable n_missing      skew
    #> 1       Fair    price         0 1.5741334
    #> 2       Fair    carat         0 0.9285670
    #> 3       Good    price         0 1.4885765
    #> 4       Good    carat         0 1.0207909
    #> 5  Very Good    price         0 1.6007752
    #> 6  Very Good    carat         0 0.9370738
    #> 7    Premium    price         0 1.4131786
    #> 8    Premium    carat         0 0.9299567
    #> 9      Ideal    price         0 1.7986601
    #> 10     Ideal    carat         0 1.3654745