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

Count with percent

A classic count() returns the number of observations.

data <- use_data_penguins()
data %>% count(island)

To add percent values, simply use count_pct() from {explore}.

data %>% count_pct(island)

Add id

data %>% glimpse()

To add an id variable, simply use add_var_id() from {explore}.

data %>% add_var_id() %>% glimpse()

User defined report

Create a user defined report (RMarkdown template) to explore your own data.

create_notebook_explore(
  output_dir = tempdir(),
  output_file = "notebook-explore.Rmd")

Data Dictionary

Create a Data Dictionary of a data set (Markdown File data_dict.md)

```{R eval=FALSE, echo=TRUE} iris %>% data_dict_md(output_dir = tempdir())

Add title, detailed descriptions and change default filename

```{R eval=FALSE, echo=TRUE}
description <- data.frame(
                  variable = c("Species"), 
                  description = c("Species of Iris flower"))
data_dict_md(iris, 
             title = "iris flower data set", 
             description =  description, 
             output_file = "data_dict_iris.md",
             output_dir = tempdir())

Color

You can make your explore-plot more colorful

data <- use_data_penguins()
data |> explore(flipper_length_mm, color = "lightskyblue")
data |>
  drop_obs_with_na() |> 
  explore(flipper_length_mm, bill_length_mm, 
          target = sex, color = c("deeppink", "blue"))

You can even mix your own colors

colors <- mix_color("blue", n = 5)
colors
show_color(colors)
colors <- mix_color("gold", "red", n = 4)
colors
show_color(colors)

Or use some of the predefined colors in {explore}

get_color()
colors <- get_color("google")
show_color(colors)


rolkra/explore documentation built on April 17, 2024, 10:58 p.m.