plot_GGenemy: Plot GGenemy

Description Usage Arguments Value Examples

View source: R/plot_GGenemy.R

Description

Plots densities of continuous variables, conditioned on quantiles of continuous variables or categories of categorical variables. For categorical variables, boxplots or barplots will be created, depending on whether the variable to be conditioned on is continuous or categorical. Either the user can use a number of same sized quantiles or can select the size of own quantiles

Usage

1
2
plot_GGenemy(dataset, given_var, var_to_plot = NULL, n_quantiles = 5,
  boxplot = FALSE, selfrange = NULL, remaining = TRUE)

Arguments

dataset

A dataframe.

given_var

A variable from your dataset.

var_to_plot

The variables to plot. When not selecting any variable, all variables from your dataset will be plotted.

n_quantiles

Number of quantiles you want to partition given_var into.

boxplot

If TRUE, all numerical variables will be presented as boxplots instead of densities. You can also provide a vector with the names of the numerics to show as boxplots if you want to use this option only for a selection of variables.

selfrange

Vector of n*2 values or matrix with 2 columns. The first value as min and the second value as max of the self selected quantile.

remaining

logical. If TRUE, the remaining values not within selfrange will be plotted to category named 'remaining'.

Value

Several ggplot graphics. The total number of plots will equal the number of variables in your dataset or the amount of variables selected in var_to_plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n <- 500
number_variables <- 5

set.seed(42)
variables <- as.data.frame(sapply(1:number_variables, function(a) {
  if (runif(1) < 0.5) {
    rnorm(n)
  } else {
    rgamma(n, 0.5)
  }
}))


plot_GGenemy(variables, "V1")

tajohu/GGenemy documentation built on Nov. 5, 2019, 9:44 a.m.