Learn R Programming

beezdemand (version 0.2.0)

beezdemand_descriptive_methods: S3 Methods for beezdemand_descriptive Objects

Description

Methods for printing, summarizing, and visualizing objects of class beezdemand_descriptive created by get_descriptive_summary().

Usage

# S3 method for beezdemand_descriptive
print(x, ...)

# S3 method for beezdemand_descriptive summary(object, ...)

# S3 method for beezdemand_descriptive plot(x, x_trans = "identity", y_trans = "identity", show_zeros = FALSE, ...)

Value

  • print() - Returns the object invisibly (called for side effects)

  • summary() - Returns a list with extended summary information

  • plot() - Returns a ggplot2 object

Arguments

x, object

A beezdemand_descriptive object

...

Additional arguments (currently unused)

x_trans

Character string specifying x-axis transformation. Options: "identity" (default), "log10", "log", "sqrt". See scales::transform_log10() etc.

y_trans

Character string specifying y-axis transformation. Options: "identity" (default), "log10", "log", "sqrt", "pseudo_log" (signed log).

show_zeros

Logical indicating whether to show proportion of zeros as labels on the boxplot (default: FALSE)

Details

Summary Method

Provides extended information including:

  • Data summary (subjects, prices analyzed)

  • Distribution of means across prices (min, median, max)

  • Proportion of zeros by price (range)

  • Missing data summary

Plot Method

Creates a boxplot showing the distribution of consumption at each price point. Features:

  • Red cross markers indicate means

  • Boxes show median and quartiles

  • Whiskers extend to 1.5 * IQR

  • Supports axis transformations (log, sqrt, etc.)

  • Uses modern beezdemand styling via theme_apa()

See Also

get_descriptive_summary()

Examples

Run this code
# \donttest{
data(apt, package = "beezdemand")
desc <- get_descriptive_summary(apt)

# Print compact summary
print(desc)

# Extended summary
summary(desc)

# Default boxplot
plot(desc)

# With log-transformed y-axis
plot(desc, y_trans = "log10")

# With pseudo-log y-axis (handles zeros gracefully)
plot(desc, y_trans = "pseudo_log")
# }

Run the code above in your browser using DataLab