explore

CRAN Version Downloads Total Downloads

Simplifies Exploratory Data Analysis.

Why this package?

How to use it

There are three ways to use the package:

The explore package automatically checks if an attribute is categorial or numerical, chooses the best plot-type and handles outliers (autosacling).

Installation

CRAN

install.packages("explore")

To install the explore package on Debian / Ubuntu, you may need to install some additional dependencies first:

sudo apt install unixodbc unixodbc-dev
install.packages("odbc")
install.packages("explore")

DEV version (github)

# install from github
if (!require(devtools)) install.packages("devtools")
devtools::install_github("rolkra/explore")

if you are behind a firewall, you may want to:

# install local
if (!require(devtools)) install.packages("devtools")
devtools::install_local(path = <path of local package>, force = TRUE)

Examples

Interactive data exploration

Example how to use the explore package to explore the iris dataset

# load package
library(explore)

# explore interactive
explore(iris)

Explore variables

example interactive exploration

Explain target (is Species a versicolor?)

# define a target (is Species versicolor?)
iris$is_versicolor <- ifelse(iris$Species == "versicolor", 1, 0)
iris$Species <- NULL

# explore interactive
explore(iris)

example interactive exploration

Automated Report

Create a report by clicking the “report all” button or use the report() function. If no target is defined, the report shows all variables. If a target is defined, the report shows the relation between all variables and the target.

Report of all variables

iris %>% report(output_dir = tempdir())

example report attributes

Report with defined target (binary target, split = FALSE)

iris %>% report(output_dir = tempdir(),
                target = is_versicolor,
                split = FALSE)

example report attributes

Manual exploration

Example how to use the functions of the explore package to explore the iris dataset

# load packages
library(explore)
library(magrittr)  # to use the pipe operator %>%

# use iris dataset
data(iris)

# explore Species
iris %>% explore(Species)

# explore Sepal.Length
iris %>% explore(Sepal.Length)

# define a target (is Species versicolor?)
iris$is_versicolor <- ifelse(iris$Species == "versicolor", 1, 0)

# explore relationship between Sepal.Length and the target
iris %>% explore(Sepal.Length, target = is_versicolor)

# explore relationship between all variables and the target
Iris %>% explore_all(target = is_versicolor)

# explore correlation between Sepal.Length and Petal.Length
iris %>% explore(Sepal.Length, Petal.Length)

# explore correlation between Sepal.Length, Petal.Length and a target
iris %>% explore(Sepal.Length, Petal.Length, target = is_versicolor)

# describe dataset
describe(iris)

# describe Species
iris %>% describe(Species)

# explain target using a decision tree
iris$Species <- NULL
iris %>% explain_tree(target = is_versicolor)

# explain target using a logistic regression
iris %>% explain_logreg(target = is_versicolor)