Skip to content

Commit 79264d9

Browse files
authored
Merge pull request #76 from mayer79/wrong_facet_order
Fix swap_dim factor order
2 parents 366bd46 + ea6205d commit 79264d9

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: hstats
22
Title: Interaction Statistics
3-
Version: 0.4.0
3+
Version: 1.0.0
44
Authors@R:
55
person("Michael", "Mayer", , "[email protected]", role = c("aut", "cre"))
66
Description: Fast, model-agnostic implementation of different H-statistics

NEWS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# hstats 0.4.0
1+
# hstats 1.0.0
22

33
## Major changes
44

R/utils_plot.R

+8-6
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ get_color_scale <- function(x) {
3030
#' @noRd
3131
#' @keywords internal
3232
#' @param df A data.frame.
33+
#' @param group Should the group variable "varying_" be reverted too? Default is `TRUE`.
3334
#'
3435
#' @returns A data.frame with reverted factor levels.
35-
barplot_reverter <- function(df) {
36-
transform(
37-
df,
38-
variable_ = factor(variable_, levels = rev(levels(variable_))),
39-
varying_ = factor(varying_, levels = rev(levels(varying_)))
40-
)
36+
barplot_reverter <- function(df, group = TRUE) {
37+
x <- c("variable_", if (group) "varying_")
38+
for (z in x) {
39+
f <- df[[z]]
40+
df[[z]] <- factor(f, levels = rev(levels(f)))
41+
}
42+
df
4143
}
4244

4345
#' Stack some Columns

R/utils_statistics.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ plot.hstats_matrix <- function(x, top_m = 15L,
310310
if (err_type != "No") {
311311
df[["error_"]] <- mat2df(err)[["value_"]]
312312
}
313-
df <- barplot_reverter(df)
313+
df <- barplot_reverter(df, group = !swap_dim)
314314

315315
if (is.null(viridis_args)) {
316316
viridis_args <- list()

packaging.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ library(usethis)
1515
use_description(
1616
fields = list(
1717
Title = "Interaction Statistics",
18-
Version = "0.4.0",
18+
Version = "1.0.0",
1919
Description = "Fast, model-agnostic implementation of different H-statistics
2020
introduced by Jerome H. Friedman and Bogdan E. Popescu (2008) <doi:10.1214/07-AOAS148>.
2121
These statistics quantify interaction strength per feature, feature pair,

0 commit comments

Comments
 (0)