Skip to content

Commit

Permalink
Fix base plot "checking for variable name" (#75)
Browse files Browse the repository at this point in the history
* Fix base plot "checking for variable name"

* Deparse "substitute"
  • Loading branch information
mnlang authored Feb 22, 2022
1 parent 0c9c86e commit ef02528
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ plot.distribution <- function(x, cdf = FALSE, p = c(0.1, 99.9), len = 1000,
# Set x and y axis labels. If the variable name is a single upper case letter
# then use that name in the labels. Otherwise, use the generic x and
# P(X = x) or f(x).
variable_name <- substitute(x)
if (nchar(variable_name) == 1 & toupper(variable_name) == variable_name) {
variable_name <- deparse(substitute(x))
if (length(variable_name) == 1 && nchar(variable_name) == 1 && toupper(variable_name) == variable_name) {
my_xlab <- tolower(substitute(x))
if (cdf) {
my_ylab <- paste0("F(", my_xlab, ")")
Expand Down

0 comments on commit ef02528

Please sign in to comment.