Learn R Programming

clhs (version 0.9.0)

plot.cLHS_result: Plot cLHS results

Description

Produces a plot illustrating the result of a cLHS sampling procedure.

Usage

# S3 method for cLHS_result
plot(x, modes = "obj", ...)

Arguments

x

Object of class “cLHS_result”.

modes

A character vector describing the plot to produce (see Details)

...

Other ggplot2 plotting parameters.

Details

The subplots to be included in the final illustration are controlled by the mode option: - "obj" adds the evolution of the objective function over the iterations - "cost" adds the evolution of the cost function over the iterations (if available in x) - "hist" adds the comparison of the distributions of each variables in both the original object and the sampled result using histogram plots (for continuous variables). - "dens" adds the comparison of the distributions of each variables in both the original object and the sampled result using density plots (for continuous variables). - "box" adds the comparison of the distributions of each variables in both the original object and the sampled result using boxplots (for continuous variables).

See Also

clhs

Examples

Run this code
# NOT RUN {
df <- data.frame(
  a = runif(1000), 
  b = rnorm(1000), 
  c = sample(LETTERS[1:5], size = 1000, replace = TRUE)
)

res <- clhs(df, size = 50, iter = 1000, use.cpp = FALSE, progress = FALSE, simple = FALSE)

# You can plot only the objective function
plot(res, mode = "obj")

# Or you can compare the distribution in the original object 
# and in the sampled result
plot(res, mode = c("obj", "box"))

	
# }

Run the code above in your browser using DataLab