library(rENA)
rows <- data.frame(
unit = rep(paste0("U", 1:6), each = 4),
conv = rep(rep(c("c1", "c2"), each = 2), times = 6),
grp = rep(c("g1", "g2"), each = 12),
score = rep(c(10, 20, 30, 40, 50, 60), each = 4),
A = c(1,0,1,0, 0,1,1,1, 1,1,0,1, 0,0,1,0, 1,0,0,1, 0,1,1,0),
B = c(0,1,1,1, 1,1,0,0, 0,1,1,0, 1,0,0,1, 0,1,1,0, 1,0,0,1),
C = c(1,1,0,0, 1,0,1,0, 1,0,0,1, 0,1,1,1, 1,1,0,0, 0,0,1,1),
D = c(0,0,1,1, 0,1,0,1, 0,1,1,0, 1,1,0,0, 0,0,1,1, 1,1,0,0),
stringsAsFactors = FALSE)
acc <- ena.accumulate.data(
units = rows[, "unit", drop = FALSE], conversation = rows[, "conv", drop = FALSE],
metadata = rows[, c("grp", "score")], codes = rows[, c("A","B","C","D")],
window.size.back = 2)
set <- ena.make.set(acc, dimensions = 2)
Summary
ena.rotate.by.hena.regressionnames its rotation axes after the first edge rather than the predictor. With bothx_varandy_var, both columns get the same name.Severity: low — cosmetic, but produces duplicate column names.
Setup (rENA 0.3.1, R 4.4.2)
Reproduce
Root cause
ena.rotate.by.regression.R:75derives the name withxName <- all.vars(x)[2], which assumesxis a formula object.params$x_varis a character string, andall.vars()on a string returns nothing:So
is.na(all.vars(x)[2])is alwaysTRUEand the branch falls back toxName <- names(v1)[1]— the first edge name. Line 121 does the same foryName, so with both axes the columns collide.Suggested fix
Coerce first, e.g.
all.vars(as.formula(x))[2].What ena-python does
Names the axis after the predictor (
score_reg,grp_reg). Names are cosmetic and the vectors match, so ena-python does not reproduce this.