Skip to content

Commit 4fe17ac

Browse files
committed
fix issue with LDA in case of a single axis (comparison of two scenarii)
1 parent d34f0c7 commit 4fe17ac

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

R-pkg/R/85_rf_graph_output.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ lda_coordinate_graph <- function(proj_dir, prefix = "modelchoice_out") {
143143
# LDA latent space coordinates
144144
file_name <- file.path(proj_dir, str_c(prefix, ".lda"))
145145
lda_coord <- read.table(file_name, skip = 1)
146+
lda_dim <- ncol(lda_coord)
146147

147148
# check for number of LDA components
148-
if(ncol(lda_coord) < 2) {
149+
if(lda_dim < 2) {
149150
txt <- "No LDA axis,\n impossible to create\n a LDA plot"
150151
g1 <- ggplot() +
151152
annotate("text", x = 4, y = 25, size=8, label = txt) +
@@ -170,7 +171,7 @@ lda_coordinate_graph <- function(proj_dir, prefix = "modelchoice_out") {
170171
)
171172

172173
# single LDA axes (in case of two scenarii)
173-
if(ncol(lda_coord) == 2) {
174+
if(lda_dim == 2) {
174175
g1 <- ggplot(lda_coord) +
175176
geom_density(
176177
data = subset(lda_coord, lda_coord$tag == "simulations"),

0 commit comments

Comments
 (0)