Skip to content

Commit

Permalink
1.3.3.9001
Browse files Browse the repository at this point in the history
  • Loading branch information
rolkra committed Sep 15, 2024
1 parent 31df831 commit 66d92b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: explore
Title: Simplifies Exploratory Data Analysis
Version: 1.3.3.9000
Version: 1.3.3.9001
Authors@R:
person("Roland", "Krasser", , "[email protected]", role = c("aut", "cre"))
Description: Interactive data exploration with one line of code, automated
Expand Down
13 changes: 13 additions & 0 deletions R/explore.R
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,12 @@ explore_cor <- function(data, x, y, target, bins = 8, min_val = NA, max_val = NA

}

else if(x_type == "cat" & is.numeric(data[[y_txt]]) & (x_descr$unique == nrow(data))) {

p <- explore_col(data, !!x_quo, !!y_quo, ...)

}

else if(x_type == "cat" & y_type == "num") {

data[[x_txt]] <- as.factor(data[[x_txt]])
Expand Down Expand Up @@ -1980,6 +1986,7 @@ explore_count <- function(data, cat, n, target, pct = FALSE, split = TRUE, title
#' @param subtitle Subtitle of the plot
#' @param numeric Display variable as numeric (not category)
#' @param max_cat Maximum number of categories to be plotted
#' @param na Value to use for NA
#' @param flip Flip plot? (for categorical variables)
#' @param color Color for bar
#' @return Plot object
Expand All @@ -1994,6 +2001,7 @@ explore_col <- function(data, var_label, var_value,
title = NA, subtitle = "",
numeric = FALSE,
max_cat = 30,
na = 0,
flip = NA,
color = "#ADD8E6") {

Expand Down Expand Up @@ -2029,6 +2037,11 @@ explore_col <- function(data, var_label, var_value,
stop("var_value must be a numeric variable")
}

# replance NA values (is wanted)
if (!is.na(na)) {
data[val_txt] <- ifelse(is.na(data[[val_txt]]), na, data[[val_txt]])
}

data_plot <- data[ , c(lab_txt, val_txt)]
names(data_plot) <- c("label", "value")

Expand Down
3 changes: 3 additions & 0 deletions man/explore_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 66d92b7

Please sign in to comment.