SmartEDA (version 0.3.2)

ExpNumViz: Distributions of numeric variables

Description

This function automatically scans through each variable and creates density plot, scatter plot and box plot for continuous variable.

Usage

ExpNumViz (data,target=NULL,type=1,nlim=NULL,fname=NULL,col=NULL,Page=NULL,
sample=NULL,scatter=FALSE,gtitle=NULL,theme="Default")

Arguments

data

dataframe or matrix

target

target variable

type

1 (boxplot by category and overall), 2 (boxplot by category only), 3 (boxplot for overall)

nlim

numeric variable unique limit. Default nlim is 3, graph will exclude the numeric variable which is having less than 'nlim' unique value

fname

output file name

col

define the fill color for box plot. Number of color should be equal to number of categories in target variable

Page

output pattern. if Page=c(3,2), It will generate 6 plots with 3 rows and 2 columns

sample

random selection of plots

scatter

option to run scatter plot between all the numerical variables (default scatter=FALSE)

gtitle

chart title

theme

extra themes, geoms, and scales for 'ggplot2' (use theme from ggthemes package)

Value

returns collated graphs in PDF or JPEG format

Scatter plot for numeric data

Density plot for numeric data

Boxplot <U+2013> by overall

Boxplot <U+2013> by group (target variable)

Boxplot <U+2013> by overall and group (target variable)

Details

This function automatically scan each variables and generate a graph based on the user inputs. Graphical representation includes scatter plot, box plot and density plots. If input "target" is continuous then output is scatter plots

If input "target" is categorical then output is box plot.

If input "target" is NULL, means there is no target variable and this will generate density plot for all numeric features

To plot only scatter plot : target is categorical or NULL and scatter = TRUE

See Also

geom_boxplot

Examples

Run this code
# NOT RUN {
## Generate Boxplot by category
ExpNumViz(mtcars,target="gear",type=2,nlim=25,Page = c(2,2),sample=4)
## Generate Density plot
ExpNumViz(mtcars,target=NULL,type=3,nlim=25,Page = c(2,2),sample=4)
## Generate Scatter plot by Dependent variable
ExpNumViz(mtcars,target="carb",type=3,nlim=25,Page = c(2,2),sample=4)
## Generate Scatter plot for all the numerical variables
ExpNumViz(mtcars,target="gear",scatter=TRUE,gtitle="Scatter plot",theme="Default",sample=2)
ExpNumViz(mtcars,target=NULL,scatter=TRUE,gtitle="Scatter plot",theme="Default",sample=2)
# }

Run the code above in your browser using DataLab