The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
In exploratory data analysis, it is common to want to make two
different plots for same variables. For example, a survey data may have
a large number of questions like age, gender, region etc. It includes
several categorical and numerical features. Suppose a analyst want to
see age variable distributions with gender and without gender in side by
side view. There is no direct functions available in any of the
statistical packages. Here is a way to achieve the same thing using R
using ggplot2 customized function ExpTwoPlots
Function definition:
ExpTwoPlots(
data,
plot_type = "numeric",
iv_variables = NULL,
target = NULL,
lp_geom_type = "boxplot",
lp_arg_list = list(),
rp_geom_type = "boxplot",
rp_arg_list = list(),
fname = NULL,
page = NULL,
theme = "Default"
)
Different use cases
= "gear"
target <- c("vs", "carb") # we can add as many categorical variables
categorical_features <- c("mpg", "qsec") # we can add as many numerical variables numeircal_features
<- ExpTwoPlots(mtcars,
num_1 plot_type = "numeric",
iv_variables = numeircal_features,
target = NULL,
lp_arg_list = list(fill="orange"),
lp_geom_type = 'boxplot',
rp_arg_list = list(alpha=0.5, fill="white", color = "red", binwidth=1),
rp_geom_type = 'histogram',
page = c(2,1),
theme = "Default")
num_1
## $`0`
<- ExpTwoPlots(mtcars,
num_2 plot_type = "numeric",
iv_variables = numeircal_features,
target = NULL,
lp_arg_list = list(fill = "white",color = "red", binwidth=1),
lp_geom_type = 'histogram',
rp_arg_list = list(alpha=0.5, fill="red"),
rp_geom_type = 'density',
page = c(2,1),
theme = "Default")
num_2
## $`0`
<- ExpTwoPlots(mtcars,
num_3 plot_type = "numeric",
iv_variables = numeircal_features,
target = NULL,
lp_arg_list = list(color = "red"),
lp_geom_type = 'density',
rp_arg_list = list(fill="orange"),
rp_geom_type = 'boxplot',
page = c(2,1),
theme = "Default")
num_3
## $`0`
<- ExpTwoPlots(mtcars,
num_4 plot_type = "numeric",
iv_variables = numeircal_features,
target = NULL,
lp_arg_list = list(fill = "blue"),
lp_geom_type = 'qqplot',
rp_arg_list = list(fill="orange"),
rp_geom_type = 'boxplot',
page = c(2,1),
theme = "Default")
num_4
## $`0`
<- ExpTwoPlots(mtcars,
num_21 plot_type = "numeric",
iv_variables = numeircal_features,
target = "gear",
lp_arg_list = list(fill="pink"),
lp_geom_type = 'boxplot',
rp_arg_list = list(alpha=0.5, fill = c("grey", "orange", "lightblue"), binwidth=1),
rp_geom_type = 'histogram',
page = c(2,1),
theme = "Default")
num_21
## $`0`
<- ExpTwoPlots(mtcars,
num_22 plot_type = "numeric",
iv_variables = numeircal_features,
target = "gear",
lp_arg_list = list(fill = "white",color = "red", binwidth=1),
lp_geom_type = 'histogram',
rp_arg_list = list(alpha=0.5, fill = c("red", "orange", "pink")),
rp_geom_type = 'density',
page = c(2,1),
theme = "Default")
num_22
## $`0`
<- ExpTwoPlots(mtcars,
num_23 plot_type = "numeric",
iv_variables = numeircal_features,
target = "gear",
lp_arg_list = list(fill = "grey"),
lp_geom_type = 'density',
rp_arg_list = list(fill = c("blue", "orange", "pink"), alpha=0.5),
rp_geom_type = 'boxplot',
page = c(2,1),
theme = "Default")
num_23
## $`0`
<- ExpTwoPlots(mtcars,
num_24 plot_type = "numeric",
iv_variables = numeircal_features,
target = "gear",
lp_arg_list = list(fill = "grey"),
lp_geom_type = 'qqplot',
rp_arg_list = list(fill = c("blue", "orange", "pink"), alpha=0.5),
rp_geom_type = 'density',
page = c(2,1),
theme = "Default")
num_24
## $`0`
<- ExpTwoPlots(mtcars,
num_25 plot_type = "numeric",
iv_variables = numeircal_features,
target = "gear",
lp_arg_list = list(fill = "orange"),
lp_geom_type = 'boxplot',
rp_arg_list = list(fill = c("blue", "green", "red"), alpha=0.5),
rp_geom_type = 'qqplot',
page = c(2,1),
theme = "Default")
num_25
## $`0`
<- ExpTwoPlots(mtcars,
cat_1 plot_type = "categorical",
iv_variables = categorical_features,
target = NULL,
lp_arg_list = list(),
lp_geom_type = 'donut',
rp_arg_list = list(stat = 'identity'),
rp_geom_type = 'bar',
page = c(2,1),
theme = "Default")
cat_1
## $`0`
<- ExpTwoPlots(mtcars,
cat_2 plot_type = "categorical",
iv_variables = categorical_features,
target = NULL,
lp_arg_list = list(),
lp_geom_type = 'donut',
rp_arg_list = list(),
rp_geom_type = 'pie',
page = c(2,1),
theme = "Default")
cat_2
## $`0`
<- ExpTwoPlots(mtcars,
cat_3 plot_type = "categorical",
iv_variables = categorical_features,
target = NULL,
lp_arg_list = list(stat = 'identity'),
lp_geom_type = 'barh',
rp_arg_list = list(),
rp_geom_type = 'pie',
page = c(2,1),
theme = "Default")
cat_3
## $`0`
<- ExpTwoPlots(mtcars,
cat_41 plot_type = "categorical",
iv_variables = categorical_features,
target = 'gear',
lp_arg_list = list(),
lp_geom_type = 'donut',
rp_arg_list = list(stat = 'identity'),
rp_geom_type = 'bar',
page = c(2,1),
theme = "Default")
cat_41
## $`0`
<- ExpTwoPlots(mtcars,
cat_42 plot_type = "categorical",
iv_variables = categorical_features,
target = 'gear',
lp_arg_list = list(),
lp_geom_type = 'pie',
rp_arg_list = list(stat = 'identity'),
rp_geom_type = 'barh',
page = c(2,1),
theme = "Default")
cat_42
## $`0`
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.